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

CFLAGS error #13

Closed
fengwang opened this issue Nov 12, 2019 · 9 comments
Closed

CFLAGS error #13

fengwang opened this issue Nov 12, 2019 · 9 comments

Comments

@fengwang
Copy link

How to fix the CFLAGS error like this?

pypi2pkgbuild.py Naked                                                                       
INFO:pypi2pkgbuild:Packaging python-naked 0.1.31.
Traceback (most recent call last):
  File "/bin/pypi2pkgbuild.py", line 1477, in <module>
    sys.exit(main())
  File "/bin/pypi2pkgbuild.py", line 1454, in main
    create_package(name, Options(**vars(args), is_dep=False))
  File "/bin/pypi2pkgbuild.py", line 1253, in create_package
    pkg = dispatch_package_builder(name, options)
  File "/bin/pypi2pkgbuild.py", line 1248, in dispatch_package_builder
    return cls(ref, options)
  File "/bin/pypi2pkgbuild.py", line 916, in __init__
    self._makedepends.pep503_names)
  File "/bin/pypi2pkgbuild.py", line 505, in _get_metadata
    "CFLAGS": get_makepkg_conf()["CFLAGS"],
KeyError: 'CFLAGS'

And environmental variable:

 ✘  export | grep CFLAGS
CFLAGS='-march=skylake -O2 -pipe'
@anntzer
Copy link
Owner

anntzer commented Nov 12, 2019

I think this was fixed in e49362a; can you try running master?

@fengwang
Copy link
Author

@anntzer Thx. I am currently using version 0.2 from https://aur.archlinux.org/packages/python-pypi2pkgbuild/ . I shall try the git version.

@fengwang
Copy link
Author

@anntzer I installed the git version from https://aur.archlinux.org/packages/python-pypi2pkgbuild-git/, but encountered this error:

pypi2pkgbuild.py --version
pypi2pkgbuild.py 0.1.post80+gd5bf733
pypi2pkgbuild.py tifffile 
INFO:pypi2pkgbuild:Packaging python-tifffile 2019.7.26.
Error: Command '['/tmp/tmpwis3tdb4/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
ERROR:pypi2pkgbuild:Failed to obtain metadata for tifffile==2019.7.26.*,<2019.7.26.1.
pypi2pkgbuild.py Naked   
INFO:pypi2pkgbuild:Packaging python-naked 0.1.31.
Error: Command '['/tmp/tmpbffcc8z6/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
ERROR:pypi2pkgbuild:Failed to obtain metadata for Naked==0.1.31.*,<0.1.31.1.

Please let me know if you need more info in case you cannot duplicate this error.

@anntzer
Copy link
Owner

anntzer commented Nov 12, 2019

I cannot repro the issue with tifffile, it builds fine for me. Perhaps run with --verbose and see whether the logs say anything interesting?
I can observe a different issue with naked, which is that the latest release of naked has a dependency on itself (chrissimpkins/naked#19) which sends pypi2pkgbuild in an infinite loop as it tries to build the dependent packages first -- but that's really an issue on naked's side.

@fengwang
Copy link
Author

@anntzer I have produced the following logs from tifffile

pypi2pkgbuild.py tifffile --verbose
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile pkgfile >/dev/null
DEBUG:pypi2pkgbuild:Running subprocess:
(shopt -s nocaseglob; pacman -Qo /usr/lib/python3.7/site-packages/tifffile-*-info 2>/dev/null) | rev | cut -d' ' -f1,2 | rev
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -riv '^/usr/lib/python3\.7/site-packages/tifffile-.*py3\.7\.egg-info' | cut -f1 | uniq | cut -d/ -f2
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -riv '^/usr/lib/python3\.7/tifffile-.*py3\.7\.egg-info' | cut -f1 | uniq | cut -d/ -f2
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -l python-tifffile 2>/dev/null | grep -Po '(?<=site-packages/)[^-/]*(?=.*\.egg-info/?$)'
INFO:pypi2pkgbuild:Packaging python-tifffile 2019.7.26.
DEBUG:pypi2pkgbuild:Running subprocess:
(shopt -s nocaseglob; pacman -Qo /usr/lib/python3.7/site-packages/pip-*-info 2>/dev/null) | rev | cut -d' ' -f1,2 | rev
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -riv '^/usr/lib/python3\.7/site-packages/pip-.*py3\.7\.egg-info' | cut -f1 | uniq | cut -d/ -f2
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -l python-pip 2>/dev/null | grep -Po '(?<=site-packages/)[^-/]*(?=.*\.egg-info/?$)'
DEBUG:pypi2pkgbuild:Running subprocess from /tmp/tmpdnnlbzwi:
makepkg --printsrcinfo | grep -Po '(?<=^\tmakedepends = ).*'
DEBUG:pypi2pkgbuild:Running subprocess:
pacman -Q python-pip >/dev/null 2>&1
DEBUG:pypi2pkgbuild:Running subprocess from /tmp/tmp4ns67hcs:
makepkg
DEBUG:pypi2pkgbuild:Running subprocess:

set -e
python -mvenv /tmp/tmp_z1ko5lz
# Leave the source directory, which may contain wheels/sdists/etc.
cd /tmp/tmp_z1ko5lz
. '/tmp/tmp_z1ko5lz/bin/activate'
pip install --upgrade pip >/dev/null
install_cmd() {
    pip freeze | cut -d= -f1 | sort >'/tmp/tmp_z1ko5lz/pre_install_list'
    if ! pip install --no-deps 'tifffile==2019.7.26.*,<2019.7.26.1'; then
        return 1
    fi
    pip freeze | cut -d= -f1 | sort >'/tmp/tmp_z1ko5lz/post_install_list'
    # installed name, or real name if it doesn't appear
    # (setuptools, pip, Cython, numpy).
    install_name="$(comm -13 '/tmp/tmp_z1ko5lz/pre_install_list' \
                             '/tmp/tmp_z1ko5lz/post_install_list')"
    # the requirement can be 'req_name==version', or a path name.
    if [[ -z "$install_name" ]]; then
        if [[ -e 'tifffile==2019.7.26.*,<2019.7.26.1' ]]; then
            install_name="$(basename 'tifffile==2019.7.26.*,<2019.7.26.1' .git)"
        else
            install_name="$(echo 'tifffile==2019.7.26.*,<2019.7.26.1' | cut -d= -f1 -)"
        fi
    fi
}
show_cmd() {
    python - "$(pip show -v "$install_name")" <<EOF
from email.parser import Parser
import json
import sys
print(json.dumps(dict(Parser().parsestr(sys.argv[1]))))
EOF
}
if install_cmd >/tmp/tmpktnkeaf7; then
    show_cmd
else
    pip install numpy >/dev/null
    echo numpy >>/tmp/tmp0x0xmmgu
    install_cmd >/tmp/tmpktnkeaf7
    show_cmd
fi

Error: Command '['/tmp/tmp_z1ko5lz/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
ERROR:pypi2pkgbuild:Failed to obtain metadata for tifffile==2019.7.26.*,<2019.7.26.1.

and from tiffile

pypi2pkgbuild.py tiffile --verbose 
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile pkgfile >/dev/null
DEBUG:pypi2pkgbuild:Running subprocess:
(shopt -s nocaseglob; pacman -Qo /usr/lib/python3.7/site-packages/tiffile-*-info 2>/dev/null) | rev | cut -d' ' -f1,2 | rev
DEBUG:pypi2pkgbuild:Running subprocess:
pacman -Q python-tiffile 2>/dev/null
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -riv '^/usr/lib/python3\.7/site-packages/tiffile-.*py3\.7\.egg-info' | cut -f1 | uniq | cut -d/ -f2
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -riv '^/usr/lib/python3\.7/tiffile-.*py3\.7\.egg-info' | cut -f1 | uniq | cut -d/ -f2
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -l python-tiffile 2>/dev/null | grep -Po '(?<=site-packages/)[^-/]*(?=.*\.egg-info/?$)'
INFO:pypi2pkgbuild:Packaging python-tiffile 2018.10.18.
DEBUG:pypi2pkgbuild:Running subprocess:
(shopt -s nocaseglob; pacman -Qo /usr/lib/python3.7/site-packages/pip-*-info 2>/dev/null) | rev | cut -d' ' -f1,2 | rev
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -riv '^/usr/lib/python3\.7/site-packages/pip-.*py3\.7\.egg-info' | cut -f1 | uniq | cut -d/ -f2
DEBUG:pypi2pkgbuild:Running subprocess:
pkgfile -l python-pip 2>/dev/null | grep -Po '(?<=site-packages/)[^-/]*(?=.*\.egg-info/?$)'
DEBUG:pypi2pkgbuild:Running subprocess from /tmp/tmpdt04px9u:
makepkg --printsrcinfo | grep -Po '(?<=^\tmakedepends = ).*'
DEBUG:pypi2pkgbuild:Running subprocess:
pacman -Q python-pip >/dev/null 2>&1
DEBUG:pypi2pkgbuild:Running subprocess from /tmp/tmpg4n6begq:
makepkg
DEBUG:pypi2pkgbuild:Running subprocess:

set -e
python -mvenv /tmp/tmplb9tjssu
# Leave the source directory, which may contain wheels/sdists/etc.
cd /tmp/tmplb9tjssu
. '/tmp/tmplb9tjssu/bin/activate'
pip install --upgrade pip >/dev/null
install_cmd() {
    pip freeze | cut -d= -f1 | sort >'/tmp/tmplb9tjssu/pre_install_list'
    if ! pip install --no-deps 'tiffile==2018.10.18.*,<2018.10.18.1'; then
        return 1
    fi
    pip freeze | cut -d= -f1 | sort >'/tmp/tmplb9tjssu/post_install_list'
    # installed name, or real name if it doesn't appear
    # (setuptools, pip, Cython, numpy).
    install_name="$(comm -13 '/tmp/tmplb9tjssu/pre_install_list' \
                             '/tmp/tmplb9tjssu/post_install_list')"
    # the requirement can be 'req_name==version', or a path name.
    if [[ -z "$install_name" ]]; then
        if [[ -e 'tiffile==2018.10.18.*,<2018.10.18.1' ]]; then
            install_name="$(basename 'tiffile==2018.10.18.*,<2018.10.18.1' .git)"
        else
            install_name="$(echo 'tiffile==2018.10.18.*,<2018.10.18.1' | cut -d= -f1 -)"
        fi
    fi
}
show_cmd() {
    python - "$(pip show -v "$install_name")" <<EOF
from email.parser import Parser
import json
import sys
print(json.dumps(dict(Parser().parsestr(sys.argv[1]))))
EOF
}
if install_cmd >/tmp/tmpj9pi6_nn; then
    show_cmd
else
    pip install numpy >/dev/null
    echo numpy >>/tmp/tmpy6yc8hob
    install_cmd >/tmp/tmpj9pi6_nn
    show_cmd
fi

Error: Command '['/tmp/tmplb9tjssu/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
ERROR:pypi2pkgbuild:Failed to obtain metadata for tiffile==2018.10.18.*,<2018.10.18.1.

@anntzer
Copy link
Owner

anntzer commented Nov 12, 2019

What happens when you run python -mvenv /tmp/testenv?

@fengwang
Copy link
Author

It directly gives out the error message: Error: Command '['/tmp/testenv/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

@anntzer
Copy link
Owner

anntzer commented Nov 12, 2019

Looks like something is wrong with your python install? venv is stdlib (https://docs.python.org/3/library/venv.html) so if you can't make it work, consider opening a bug e.g. on the Arch Linux tracker?

@fengwang
Copy link
Author

@anntzer You are right. Seems a problem with my python. I tried this command on Arch, it works well. But not on Manjaro. Thanks a lot for your kind help. I will close this issue now.

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