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

setuptools_scm hides errors from git in some cases #136

Closed
brianmay opened this issue Nov 30, 2016 · 4 comments
Closed

setuptools_scm hides errors from git in some cases #136

brianmay opened this issue Nov 30, 2016 · 4 comments

Comments

@brianmay
Copy link
Contributor

brianmay commented Nov 30, 2016

I don't understand what is going on here - it seemed to work last time I tried this. Don't understand why it can't find the git command under tox either - git is installed:

$ tox -e py35        
GLOB sdist-make: /home/brian/tree/karaage/python-tldap/setup.py
py35 inst-nodeps: /home/brian/tree/karaage/python-tldap/.tox/dist/python-tldap-0.3.19.dev1+ng49acbbf.d20161201.zip
py35 installed: Django==1.10.3,ldap3==1.4.0,passlib==1.7.0,pyasn1==0.1.9,python-tldap==0.3.19.dev1+ng49acbbf.d20161201,setuptools-scm==1.15.0,six==1.10.0
py35 runtests: PYTHONHASHSEED='1976067474'
py35 runtests: commands[0] | ./setup.py test
/home/brian/tree/karaage/python-tldap/.tox/py35/lib/python3.5/site-packages/setuptools_scm/utils.py:108: UserWarning: 'git' was not found
  warnings.warn("%r was not found" % name)
Traceback (most recent call last):
  File "/home/brian/tree/karaage/python-tldap/setup.py", line 71, in <module>
    test_suite="tldap.tests",
  File "/home/brian/.pyenv/versions/3.5.1/lib/python3.5/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/home/brian/tree/karaage/python-tldap/.tox/py35/lib/python3.5/site-packages/setuptools/dist.py", line 318, in __init__
    _Distribution.__init__(self, attrs)
  File "/home/brian/.pyenv/versions/3.5.1/lib/python3.5/distutils/dist.py", line 281, in __init__
    self.finalize_options()
  File "/home/brian/tree/karaage/python-tldap/.tox/py35/lib/python3.5/site-packages/setuptools/dist.py", line 376, in finalize_options
    ep.load()(self, ep.name, value)
  File "/home/brian/tree/karaage/python-tldap/.tox/py35/lib/python3.5/site-packages/setuptools_scm/integration.py", line 19, in version_keyword
    dist.metadata.version = get_version(**value)
  File "/home/brian/tree/karaage/python-tldap/.tox/py35/lib/python3.5/site-packages/setuptools_scm/__init__.py", line 117, in get_version
    parsed_version = _do_parse(root, parse)
  File "/home/brian/tree/karaage/python-tldap/.tox/py35/lib/python3.5/site-packages/setuptools_scm/__init__.py", line 95, in _do_parse
    "use git+https://github.com/user/proj.git#egg=proj" % root)
LookupError: setuptools-scm was unable to detect version for '/home/brian/tree/karaage/python-tldap'.

Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.

For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
ERROR: InvocationError: '/home/brian/tree/karaage/python-tldap/setup.py test'
_________________________________________________________________ summary __________________________________________________________________
ERROR:   py35: commands failed
@brianmay
Copy link
Contributor Author

brianmay commented Dec 1, 2016

Oh, looks like it is something weird to do with a python wrapper I have around git, simplified version that causes the failure:

#!/usr/bin/python
import os
import sys
import subprocess

home = os.environ['HOME']
os.execvp("/usr/bin/git", ["/usr/bin/git"] + sys.argv[1:])

If I delete the os.environ['HOME'] lookup it works. Weird. So starting to think this may not be setuptools_scm issue, unless it is doing something truly weird when searching for git.

@brianmay
Copy link
Contributor Author

brianmay commented Dec 1, 2016

Oh, what I imagine is happening is the HOME environment variable isn't set, so this results in the process generating an exception - which setuptools_scm conveniently hides.

I am just going to assume that is the problem, and close this ticket.

@brianmay brianmay closed this as completed Dec 1, 2016
@brianmay
Copy link
Contributor Author

brianmay commented Dec 1, 2016

Having said that I really don't like it when applications silently hide errors like this; if git was broken, I want to know about it.

@RonnyPfannschmidt RonnyPfannschmidt changed the title breaks tox tests setuptools_scm hides errors from git in some cases Dec 1, 2016
@RonnyPfannschmidt
Copy link
Contributor

fixed as sidecar of #339

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

No branches or pull requests

2 participants