Comments (15)
I ran into the same issue while trying to resolve setuptools update / build update build issues in factory.
from python-rpm-macros.
I was also trying to update build, and I added %define _pyproject_wheeldir project-build
to the spec file, which gets it building, but then it fails when building tests.
from python-rpm-macros.
I tried to build without modifying the python-rpm-macros, that's what worked for me in the python-build.spec file:
%build
# Can't use %%pyproject_wheel because the module name is build and
# conflicts with the temp build folder created in that macro
%{python_expand #
rm -rf project-build
mkdir -p project-build
$python -mpip wheel --verbose --progress-bar off --disable-pip-version-check --use-pep517 --no-build-isolation --no-deps --wheel-dir ./project-build .
mv project-build _build.%{$python_prefix}
}
from python-rpm-macros.
Are you talking about %_pyproject_wheeldir
, which just tells %pyproject_wheel
where to place the built wheels and %pyproject_install
where to look for it, or about the build/
directory which gets shuffled around in between all flavor expansions? The latter predates the %_pyproject_wheeldir
by years. Note that cmake uses the same directory name, and other build tools probably too.
from python-rpm-macros.
[ 94s] _________________________ test_build_wheel[from_sdist] _________________________
[ 94s] [gw4] linux -- Python 3.8.16 /usr/bin/python3.8
[ 94s]
[ 94s] monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f9c11850b80>
[ 94s] tmpdir = local('/tmp/pytest-of-abuild/pytest-15/popen-gw4/test_build_wheel_from_sdist_0')
[ 94s] args = ()
[ 94s]
[ 94s] @pytest.mark.parametrize('args', ((), ('--wheel',)), ids=('from_sdist', 'direct'))
[ 94s] def test_build_wheel(monkeypatch, tmpdir, args):
[ 94s]
[ 94s] monkeypatch.chdir(MAIN_DIR)
[ 94s]
[ 94s] > subprocess.run(
[ 94s] [
[ 94s] sys.executable,
[ 94s] '-m',
[ 94s] 'build',
[ 94s] *args,
[ 94s] '--outdir',
[ 94s] str(tmpdir),
[ 94s] ],
[ 94s] check=True,
[ 94s] )
[ 94s]
[ 94s] tests/test_self_packaging.py:71:
[ 94s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 94s]
[ 94s] input = None, capture_output = False, timeout = None, check = True
[ 94s] popenargs = (['/usr/bin/python3.8', '-m', 'build', '--outdir', '/tmp/pytest-of-abuild/pytest-15/popen-gw4/test_build_wheel_from_sdist_0'],)
[ 94s] kwargs = {}, process = <subprocess.Popen object at 0x7f9c11850a60>
[ 94s] stdout = None, stderr = None, retcode = 1
[ 94s]
[ 94s] def run(*popenargs,
[ 94s] input=None, capture_output=False, timeout=None, check=False, **kwargs):
[ 94s] """Run command with arguments and return a CompletedProcess instance.
[ 94s]
[ 94s] The returned instance will have attributes args, returncode, stdout and
[ 94s] stderr. By default, stdout and stderr are not captured, and those attributes
[ 94s] will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.
[ 94s]
[ 94s] If check is True and the exit code was non-zero, it raises a
[ 94s] CalledProcessError. The CalledProcessError object will have the return code
[ 94s] in the returncode attribute, and output & stderr attributes if those streams
[ 94s] were captured.
[ 94s]
[ 94s] If timeout is given, and the process takes too long, a TimeoutExpired
[ 94s] exception will be raised.
[ 94s]
[ 94s] There is an optional argument "input", allowing you to
[ 94s] pass bytes or a string to the subprocess's stdin. If you use this argument
[ 94s] you may not also use the Popen constructor's "stdin" argument, as
[ 94s] it will be used internally.
[ 94s]
[ 94s] By default, all communication is in bytes, and therefore any "input" should
[ 94s] be bytes, and the stdout and stderr will be bytes. If in text mode, any
[ 94s] "input" should be a string, and stdout and stderr will be strings decoded
[ 94s] according to locale encoding, or by "encoding" if set. Text mode is
[ 94s] triggered by setting any of text, encoding, errors or universal_newlines.
[ 94s]
[ 94s] The other arguments are the same as for the Popen constructor.
[ 94s] """
[ 94s] if input is not None:
[ 94s] if kwargs.get('stdin') is not None:
[ 94s] raise ValueError('stdin and input arguments may not both be used.')
[ 94s] kwargs['stdin'] = PIPE
[ 94s]
[ 94s] if capture_output:
[ 94s] if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
[ 94s] raise ValueError('stdout and stderr arguments may not be used '
[ 94s] 'with capture_output.')
[ 94s] kwargs['stdout'] = PIPE
[ 94s] kwargs['stderr'] = PIPE
[ 94s]
[ 94s] with Popen(*popenargs, **kwargs) as process:
[ 94s] try:
[ 94s] stdout, stderr = process.communicate(input, timeout=timeout)
[ 94s] except TimeoutExpired as exc:
[ 94s] process.kill()
[ 94s] if _mswindows:
[ 94s] # Windows accumulates the output in a single blocking
[ 94s] # read() call run on child threads, with the timeout
[ 94s] # being done in a join() on those threads. communicate()
[ 94s] # _after_ kill() is required to collect that and add it
[ 94s] # to the exception.
[ 94s] exc.stdout, exc.stderr = process.communicate()
[ 94s] else:
[ 94s] # POSIX _communicate already populated the output so
[ 94s] # far into the TimeoutExpired exception.
[ 94s] process.wait()
[ 94s] raise
[ 94s] except: # Including KeyboardInterrupt, communicate handled that.
[ 94s] process.kill()
[ 94s] # We don't call process.wait() as .__exit__ does that for us.
[ 94s] raise
[ 94s] retcode = process.poll()
[ 94s] if check and retcode:
[ 94s] > raise CalledProcessError(retcode, process.args,
[ 94s] output=stdout, stderr=stderr)
[ 94s] E subprocess.CalledProcessError: Command '['/usr/bin/python3.8', '-m', 'build', '--outdir', '/tmp/pytest-of-abuild/pytest-15/popen-gw4/test_build_wheel_from_sdist_0']' returned non-zero exit status 1.
[ 94s]
[ 94s] /usr/lib64/python3.8/subprocess.py:516: CalledProcessError
[ 94s] ----------------------------- Captured stdout call -----------------------------
[ 94s] * Creating venv isolated environment...
[ 94s] * Installing packages in isolated environment... (flit-core >= 3.4)
[ 94s] * Getting build dependencies for sdist...
[ 94s]
[ 94s] ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist
[ 94s] ----------------------------- Captured stderr call -----------------------------
[ 94s] Traceback (most recent call last):
[ 94s] File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
[ 94s] main()
[ 94s] File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
[ 94s] json_out['return_val'] = hook(**hook_input['kwargs'])
[ 94s] File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 287, in get_requires_for_build_sdist
[ 94s] return hook(config_settings)
[ 94s] File "/tmp/build-env-v8xpqmib/lib64/python3.8/site-packages/flit_core/buildapi.py", line 31, in get_requires_for_build_wheel
[ 94s] module = Module(info.module, Path.cwd())
[ 94s] File "/tmp/build-env-v8xpqmib/lib64/python3.8/site-packages/flit_core/common.py", line 50, in __init__
[ 94s] raise ValueError(
[ 94s] ValueError: Multiple files or folders could be module build: /home/abuild/rpmbuild/BUILD/build-0.10.0/build, /home/abuild/rpmbuild/BUILD/build-0.10.0/src/build
from python-rpm-macros.
- https://docs.python.org/3/library/sys_path_init.html#pth-files
- https://docs.python.org/3/using/cmdline.html#cmdoption-P
- https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSAFEPATH
from python-rpm-macros.
New in version 3.11.
which won't help us for 3.8
from python-rpm-macros.
@bnavigator But also, cmake isn't trying to build a module called 'build', which is more the problem here.
I've tracked down the test failures to %python_flavored_alternatives
, which is separate from this issue, but still related, since it hardcodes mkdir -p build/flavorbin
and then flit-core dies with the above ValueError.
from python-rpm-macros.
But there are python modules building with cmake as backend
from python-rpm-macros.
since it hardcodes
mkdir -p build/flavorbin
and then flit-core dies with the above ValueError.
It merely reuses the hardcoded shuffle dir:
Lines 12 to 26 in 050c1a4
Note the the creation of the build/
folder traditionally comes from python3 setup.py build ...
and python3 -m pip wheel ...
. It is completely independent of python-rpm-macros.
from python-rpm-macros.
... isn't trying to build a module called 'build', which is more the problem here.
And how often is that a problem so that it warrants a general change in the macros?
from python-rpm-macros.
from python-rpm-macros.
Has this been fixed by sr#1073633
?
from python-rpm-macros.
I'd consider that a workaround, but I'm not certain @bnavigator and I are going to agree.
from python-rpm-macros.
I still believe that this is a wontfix issue.
from python-rpm-macros.
Related Issues (20)
- Error in libalternatives filelist produced by the %python_alternative macro HOT 1
- export PYTHONPATH and --import-mode=append required for successful python builds HOT 7
- Shouldn’t %primary_interpreter be part of the OBS project rather than in the SPEC file? HOT 7
- Missing {} around parameter in _python_sysconfig_path/var macros HOT 1
- Old "py_requires" macro for python2 fails to expand properly on Leap 15.4 HOT 2
- libalternatives handling wrong HOT 3
- Additional flags in scriptlets (like `%pre -f`) HOT 21
- %pyproject_wheel doesn't work without %python_subpackages HOT 2
- Cannot add `--install-options` to %pyproject_install HOT 4
- Add python312 in <flavor> HOT 2
- python_compileall fails to strip the buildroot HOT 16
- Conditionally switch off providing python3-* packages for primary set HOT 16
- rewrite shebangs for "pythons python3" packages HOT 1
- Better support reproducible builds HOT 18
- Add a macro for use of build and installer HOT 12
- pip --build-option is deprecated HOT 3
- fdupes could be run for %doc files HOT 2
- Create `%pytest` and `%pyunittest` variants per flavor HOT 2
- Allow packaging of sle15_python_module_pythons but with primary on Tumbleweed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-rpm-macros.