Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local headers and c sources still needed despite PYERFA_USE_SYSTEM_LIBERFA #38

Closed
bnavigator opened this issue Jul 6, 2020 · 2 comments

Comments

@bnavigator
Copy link

erfa_generator.py uses the locally provided headers and c sources despite PYERFA_USE_SYSTEM_LIBERFA is specified. The way it is described, one would expect that only the global headers form the system's erfa-devel, liberfa-dev or whatever it is called in the distribution package would be needed. But erfa_generator.py is called with ERFA_SRC before the check for the library.

pyerfa/setup.py

Lines 29 to 40 in 85a3794

def get_extensions():
cmd = [sys.executable, 'erfa_generator.py', ERFA_SRC, '--quiet']
subprocess.run(cmd, check=True)
sources = [os.path.join('erfa', 'ufunc.c')]
include_dirs = []
libraries = []
if int(os.environ.get('PYERFA_USE_SYSTEM_LIBERFA', 0)):
libraries.append('erfa')

Steps to reproduce:

rm -rf liberfa/
export PYERFA_USE_SYSTEM_LIBERFA=1
pip install .

Output from rpm build:

+ exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature /home/abuild/rpmbuild/SOURCES/python-pyerfa.spec
[    3s] sh: python2: command not found
[    3s] setting SOURCE_DATE_EPOCH=1593993600
[    3s] Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.ZmaaIS
[    3s] + umask 022
[    3s] + cd /home/abuild/rpmbuild/BUILD
[    3s] + cd /home/abuild/rpmbuild/BUILD
[    3s] + rm -rf pyerfa-1.7.0
[    3s] + /usr/bin/gzip -dc /home/abuild/rpmbuild/SOURCES/pyerfa-1.7.0.tar.gz
[    3s] + /usr/bin/tar -xof -
[    3s] + STATUS=0
[    3s] + '[' 0 -ne 0 ']'
[    3s] + cd pyerfa-1.7.0
[    3s] + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
[    3s] + rm -rf liberfa
[    3s] + RPM_EC=0
[    3s] ++ jobs -p
[    3s] + exit 0
[    3s] Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.ozRTVW
[    3s] + umask 022
[    3s] + cd /home/abuild/rpmbuild/BUILD
[    3s] + /usr/bin/rm -rf /home/abuild/rpmbuild/BUILDROOT/python-pyerfa-1.7.0-0.x86_64
[    3s] ++ dirname /home/abuild/rpmbuild/BUILDROOT/python-pyerfa-1.7.0-0.x86_64
[    3s] + /usr/bin/mkdir -p /home/abuild/rpmbuild/BUILDROOT
[    3s] + /usr/bin/mkdir /home/abuild/rpmbuild/BUILDROOT/python-pyerfa-1.7.0-0.x86_64
[    3s] + cd pyerfa-1.7.0
[    3s] + export PYERFA_USE_SYSTEM_LIBERFA=1
[    3s] + PYERFA_USE_SYSTEM_LIBERFA=1
[    3s] ++ '[' -f _current_flavor ']'
[    3s] ++ true
[    3s] + python_flavor=
[    3s] + '[' -z '' ']'
[    3s] + python_flavor=tmp
[    3s] + '[' tmp '!=' python3 ']'
[    3s] + '[' -d build ']'
[    3s] + '[' -d _build.python3 ']'
[    3s] + echo python3
[    3s] + /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s'
[    3s] Traceback (most recent call last):
[    3s]   File "erfa_generator.py", line 682, in <module>
[    3s]     main(args.srcdir, args.output, args.ufunc, args.template_loc, args.verbose)
[    3s]   File "erfa_generator.py", line 575, in main
[    3s]     with open(erfahfn, "r") as f:
[    3s] FileNotFoundError: [Errno 2] No such file or directory: 'liberfa/erfa/erfa.h'
[    3s] Traceback (most recent call last):
[    3s]   File "setup.py", line 123, in <module>
[    3s]     ext_modules=get_extensions())
[    3s]   File "setup.py", line 31, in get_extensions
[    3s]     subprocess.run(cmd, check=True)
[    3s]   File "/usr/lib64/python3.8/subprocess.py", line 512, in run
[    3s]     raise CalledProcessError(retcode, process.args,
[    3s] subprocess.CalledProcessError: Command '['/usr/bin/python3', 'erfa_generator.py', 'liberfa/erfa/src', '--quiet']' returned non-zero exit status 1.
[    3s] error: Bad exit status from /var/tmp/rpm-tmp.ozRTVW (%build)
[    3s] 
[    3s] 
[    3s] RPM build errors:
[    3s]     Bad exit status from /var/tmp/rpm-tmp.ozRTVW (%build)
[    3s] 
[    3s] greinerT450s failed "build python-pyerfa.spec" at Mon Jul  6 09:40:03 UTC 2020.
@avalentino
Copy link
Member

Hi @bnavigator, just opened PR #39 to fix it.
Maybe you want to give it a try.

@bnavigator
Copy link
Author

Yes, the build passes! Thank you!
https://build.opensuse.org/package/show/home:bnavigator:branches:devel:languages:python:numeric/python-pyerfa

Now I am trying to build astropy with astropy/astropy#10329 applied and ASTROPY_USE_SYSTEM_ALL=1 enabled, but no luck so far...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants