Repository: pypa/setuptools

Issue:
40.1.0 breaks version detection on some packages
Hello;

I tried updating setuptools to 40.1.0 in the BuildRoot project, only to find a few packages such as
python-cryptography no longer seem to think setuptools is a version high enough to work.
Another package that has the same issue is python-funcsigs as well.

Downgrading to 40.0.0 fixes the issue.  Any idea as to what could be going on?

Thanks!


Discussion:
You'll have to give more information than that: environment? Python version? What command are you using? What are the exact errors?
@aduskett Is it possible that this is actually an issue with your local environment and that "downgrading" to version 40.0.0 actually upgraded some version on your python path from something < 18.5?

I can't reproduce this - I cloned cryptography and had no problem with either `pip install -e .` or `python setup.py install` with `setuptools==40.1.0` on either master or the tag `2.3.1`.
Python 3.7.0 is the version:

Here is the command used by BuildRoot with python-cryptography-2.3.1 and setuptools 40.1.0:

`(cd /home/vagrant/Downloads/br/output/build/python-cryptography-2.3.1//; _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata_m_linux_x86_64-linux-gnu" PATH="/home/vagrant/Downloads/br/output/host/bin:/home/vagrant/Downloads/br/output/host/sbin:/opt/rh/rh-git29/root/usr/bin:/opt/rh/devtoolset-7/root/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/vagrant/.local/bin:/home/vagrant/bin" PYTHONPATH="/home/vagrant/Downloads/br/output/target/usr/lib/python3.7/" PYTHONNOUSERSITE=1 _python_sysroot=/home/vagrant/Downloads/br/output/host/x86_64-buildroot-linux-gnu/sysroot _python_prefix=/usr _python_exec_prefix=/usr  /home/vagrant/Downloads/br/output/host/bin/python setup.py build  )`

Here is the output:

`
Traceback (most recent call last):
  File "setup.py", line 28, in <module>
    "cryptography requires setuptools 18.5 or newer, please upgrade to a "
RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools
make[1]: *** [package/pkg-generic.mk:232: /home/vagrant/Downloads/br/output/build/python-cryptography-2.3.1/.stamp_built] Error 1
make: *** [Makefile:79: _all] Error 2
`

I am more than happy to make a github project with a defconfig so anybody who wishes to test the output could do so.
```python
In [1]: import pkg_resources, setuptools
In [2]: pkg_resources.parse_version(setuptools.__version__)
Out[2]: <Version('40.0.0')>
In [3]: pkg_resources.parse_version(setuptools.__version__) < pkg_resources.parse_version("18.5")
Out[3]: False
```
It's unfortunate the error message does not show the version of setuptools available, but simplest explanation is that an older version get picked up. A buildroot (configuration?) bug? How did you update setuptools to `40.1.0`?
Setuptools is installed directly. It's never upgraded.
I modified python-cryptographies setup.py to print the found package version:

if (
    pkg_resources.parse_version(setuptools.__version__) <
    pkg_resources.parse_version("18.5")
):

raise RuntimeError(
        "cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools: " + str(pkg_resources.parse_version(setuptools.__version__))
    )

`RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools: 40.1.0.post20180820.post-20180820`

I don't understand, I've not used buildroot in a while, and not with Python packages, but isn't setuptools itself supposed to be provided (built/installed) first by buildroot (maybe be with both a host and a build version if cross-compiling)?

As for the version of setuptools you're getting, I've to ask where you got it, because that's certainly not a PEP 440 compliant version number (which explains why the comparison is failing).
Yes, setuptools is provided by buildroot itself.

Setup tools are grabbed from this repository in fact!


PYTHON_SETUPTOOLS_VERSION = v40.1.0
PYTHON_SETUPTOOLS_SITE = $(call github,pypa,setuptools,$(PYTHON_SETUPTOOLS_VERSION))

OK, so you did upgrade the setuptools version by patching the buildroot package for setuptools. What version of buildroot is that? I've not looked at the particular of the `$(call github,...)` macro, but if one of the zip/tar.gz of the Github release section is used, then I don't see how you could end up with that version number.
Indeed, it's the latest next branch.

It ends up downloading from this url: 
https://github.com/pypa/setuptools/archive/v40.1.0/python-setuptools-v40.1.0.tar.gz
Interesting fact, If I downgrade to 40.0, this is the output for cryptography:
40.0.0.post20180820
I still don't see what's happening, can you give some verbose traces for setuptools' build? Maybe add an additional trace with the output of `python setup.py --version`?
So even with '40.0.0', the version is not right.
Do you have a minimal buildroot configuration to reproduce the problem?
Yes I do:
Clone this: https://github.com/aduskett/buildroot

and run `make pythontest_defconfig` then run `make python-cryptography`

That should reproduce the issue.
OK, so I can't reproduce the issue because the build fails earlier; when building host-m4:
```
freadahead.c: In function 'freadahead':
freadahead.c:92:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."                               
  #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
```

Anyway, `setuptools.egg-info` is supposed to be generated by the call to bootstrap.py, so what's the output with:
```diff
 package/python-setuptools/python-setuptools.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git i/package/python-setuptools/python-setuptools.mk w/package/python-setuptools/python-setuptools.mk
index 590e9829..e3980a40 100644
--- i/package/python-setuptools/python-setuptools.mk
+++ w/package/python-setuptools/python-setuptools.mk
@@ -14,6 +14,7 @@ PYTHON_SETUPTOOLS_SETUP_TYPE = setuptools
 # before the standard setup process.
 define PYTHON_SETUPTOOLS_RUN_BOOTSTRAP
 	cd  $(@D) && $(HOST_DIR)/bin/python ./bootstrap.py
+	cd  $(@D) && $(HOST_DIR)/bin/python ./setup.py --version
 endef
 
 PYTHON_SETUPTOOLS_PRE_CONFIGURE_HOOKS = PYTHON_SETUPTOOLS_RUN_BOOTSTRAP
```
?
Also, what's the exact command line used to call `bootstrap.py`? Because it uses `[sys.executable, 'setup.py', 'egg_info']` at some point, which will not forward the arguments to python used to call `boostrap.py` itself (like `-s` or `-I`), which could be an issue.
host-python-setuptools v40.1.0 Extracting
gzip -d -c /home/vagrant/Downloads/br/dl/python-setuptools/python-setuptools-v40.1.0.tar.gz | /home/vagrant/Downloads/br/output/host/bin/tar --strip-components=1 -C /home/vagrant/Downloads/br/output/build/host-python-setuptools-v40.1.0   -xf -


host-python-setuptools v40.1.0 Patching
Applying 0001-add-executable.patch using patch: 
patching file setuptools/command/install.py
patching file setuptools/command/install_scripts.py
Hunk #1 succeeded at 12 (offset 1 line).
Hunk #2 succeeded at 39 (offset 1 line).


host-python-setuptools v40.1.0 Configuring
`cd  /home/vagrant/Downloads/br/output/build/host-python-setuptools-v40.1.0 && /home/vagrant/Downloads/br/output/host/bin/python ./bootstrap.py`
adding minimal entry_points
Regenerating egg_info
/home/vagrant/Downloads/br/output/host/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'zip_safe'
  warnings.warn(msg)
/home/vagrant/Downloads/br/output/host/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running egg_info
writing dependency_links to setuptools.egg-info/dependency_links.txt
writing entry points to setuptools.egg-info/entry_points.txt
writing requirements to setuptools.egg-info/requires.txt
writing manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'setuptools.egg-info/SOURCES.txt'
...and again.
running egg_info
writing setuptools.egg-info/PKG-INFO
writing dependency_links to setuptools.egg-info/dependency_links.txt
writing entry points to setuptools.egg-info/entry_points.txt
writing requirements to setuptools.egg-info/requires.txt
writing top-level names to setuptools.egg-info/top_level.txt
reading manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'setuptools.egg-info/SOURCES.txt'
`cd  /home/vagrant/Downloads/br/output/build/host-python-setuptools-v40.1.0 && /home/vagrant/Downloads/br/output/host/bin/python ./setup.py --version
40.1.0`




host-python-setuptools v40.1.0 Building
(cd /home/vagrant/Downloads/br/output/build/host-python-setuptools-v40.1.0//; PATH="/home/vagrant/Downloads/br/output/host/bin:/home/vagrant/Downloads/br/output/host/sbin:/opt/rh/rh-git29/root/usr/bin:/opt/rh/devtoolset-7/root/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/vagrant/.local/bin:/home/vagrant/bin" PYTHONNOUSERSITE=1  /home/vagrant/Downloads/br/output/host/bin/python setup.py --verbose build  )
running build
running build_py
creating build
creating build/lib
copying easy_install.py -> build/lib
creating build/lib/pkg_resources
copying pkg_resources/__init__.py -> build/lib/pkg_resources
copying pkg_resources/py31compat.py -> build/lib/pkg_resources
creating build/lib/setuptools
copying setuptools/__init__.py -> build/lib/setuptools
copying setuptools/archive_util.py -> build/lib/setuptools
copying setuptools/build_meta.py -> build/lib/setuptools
copying setuptools/config.py -> build/lib/setuptools
copying setuptools/dep_util.py -> build/lib/setuptools
copying setuptools/depends.py -> build/lib/setuptools
copying setuptools/dist.py -> build/lib/setuptools
copying setuptools/extension.py -> build/lib/setuptools
copying setuptools/glibc.py -> build/lib/setuptools
copying setuptools/glob.py -> build/lib/setuptools
copying setuptools/launch.py -> build/lib/setuptools
copying setuptools/lib2to3_ex.py -> build/lib/setuptools
copying setuptools/monkey.py -> build/lib/setuptools
copying setuptools/msvc.py -> build/lib/setuptools
copying setuptools/namespaces.py -> build/lib/setuptools
copying setuptools/package_index.py -> build/lib/setuptools
copying setuptools/pep425tags.py -> build/lib/setuptools
copying setuptools/py27compat.py -> build/lib/setuptools
copying setuptools/py31compat.py -> build/lib/setuptools
copying setuptools/py33compat.py -> build/lib/setuptools
copying setuptools/py36compat.py -> build/lib/setuptools
copying setuptools/sandbox.py -> build/lib/setuptools
copying setuptools/site-patch.py -> build/lib/setuptools
copying setuptools/ssl_support.py -> build/lib/setuptools
copying setuptools/unicode_utils.py -> build/lib/setuptools
copying setuptools/version.py -> build/lib/setuptools
copying setuptools/wheel.py -> build/lib/setuptools
copying setuptools/windows_support.py -> build/lib/setuptools
creating build/lib/pkg_resources/_vendor
copying pkg_resources/_vendor/__init__.py -> build/lib/pkg_resources/_vendor
copying pkg_resources/_vendor/appdirs.py -> build/lib/pkg_resources/_vendor
copying pkg_resources/_vendor/pyparsing.py -> build/lib/pkg_resources/_vendor
copying pkg_resources/_vendor/six.py -> build/lib/pkg_resources/_vendor
creating build/lib/pkg_resources/extern
copying pkg_resources/extern/__init__.py -> build/lib/pkg_resources/extern
creating build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/__about__.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/__init__.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/_compat.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/_structures.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/markers.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/requirements.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/specifiers.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/utils.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/version.py -> build/lib/pkg_resources/_vendor/packaging
creating build/lib/setuptools/_vendor
copying setuptools/_vendor/__init__.py -> build/lib/setuptools/_vendor
copying setuptools/_vendor/pyparsing.py -> build/lib/setuptools/_vendor
copying setuptools/_vendor/six.py -> build/lib/setuptools/_vendor
creating build/lib/setuptools/command
copying setuptools/command/__init__.py -> build/lib/setuptools/command
copying setuptools/command/alias.py -> build/lib/setuptools/command
copying setuptools/command/bdist_egg.py -> build/lib/setuptools/command
copying setuptools/command/bdist_rpm.py -> build/lib/setuptools/command
copying setuptools/command/bdist_wininst.py -> build/lib/setuptools/command
copying setuptools/command/build_clib.py -> build/lib/setuptools/command
copying setuptools/command/build_ext.py -> build/lib/setuptools/command
copying setuptools/command/build_py.py -> build/lib/setuptools/command
copying setuptools/command/develop.py -> build/lib/setuptools/command
copying setuptools/command/dist_info.py -> build/lib/setuptools/command
copying setuptools/command/easy_install.py -> build/lib/setuptools/command
copying setuptools/command/egg_info.py -> build/lib/setuptools/command
copying setuptools/command/install.py -> build/lib/setuptools/command
copying setuptools/command/install_egg_info.py -> build/lib/setuptools/command
copying setuptools/command/install_lib.py -> build/lib/setuptools/command
copying setuptools/command/py36compat.py -> build/lib/setuptools/command
copying setuptools/command/register.py -> build/lib/setuptools/command
copying setuptools/command/rotate.py -> build/lib/setuptools/command
copying setuptools/command/saveopts.py -> build/lib/setuptools/command
copying setuptools/command/sdist.py -> build/lib/setuptools/command
copying setuptools/command/setopt.py -> build/lib/setuptools/command
copying setuptools/command/test.py -> build/lib/setuptools/command
copying setuptools/command/upload.py -> build/lib/setuptools/command
copying setuptools/command/upload_docs.py -> build/lib/setuptools/command
copying setuptools/command/install_scripts.py -> build/lib/setuptools/command
creating build/lib/setuptools/extern
copying setuptools/extern/__init__.py -> build/lib/setuptools/extern
creating build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/__about__.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/__init__.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/_compat.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/_structures.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/markers.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/requirements.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/specifiers.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/utils.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/_vendor/packaging/version.py -> build/lib/setuptools/_vendor/packaging
copying setuptools/script (dev).tmpl -> build/lib/setuptools
copying setuptools/script.tmpl -> build/lib/setuptools
not copying setuptools/site-patch.py (output up-to-date)
copying setuptools/cli-32.exe -> build/lib/setuptools
copying setuptools/cli-64.exe -> build/lib/setuptools
copying setuptools/cli.exe -> build/lib/setuptools
copying setuptools/gui-32.exe -> build/lib/setuptools
copying setuptools/gui-64.exe -> build/lib/setuptools
copying setuptools/gui.exe -> build/lib/setuptools
copying setuptools/command/launcher manifest.xml -> build/lib/setuptools/command




 host-python-setuptools v40.1.0 Installing to host directory
(cd /home/vagrant/Downloads/br/output/build/host-python-setuptools-v40.1.0//; PATH="/home/vagrant/Downloads/br/output/host/bin:/home/vagrant/Downloads/br/output/host/sbin:/opt/rh/rh-git29/root/usr/bin:/opt/rh/devtoolset-7/root/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/vagrant/.local/bin:/home/vagrant/bin" PYTHONNOUSERSITE=1  /home/vagrant/Downloads/br/output/host/bin/python setup.py install --prefix=/home/vagrant/Downloads/br/output/host )
running install
running bdist_egg
running egg_info
writing setuptools.egg-info/PKG-INFO
writing dependency_links to setuptools.egg-info/dependency_links.txt
writing entry points to setuptools.egg-info/entry_points.txt
writing requirements to setuptools.egg-info/requires.txt
writing top-level names to setuptools.egg-info/top_level.txt
reading manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'setuptools.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib/easy_install.py -> build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/pkg_resources
copying build/lib/pkg_resources/__init__.py -> build/bdist.linux-x86_64/egg/pkg_resources
copying build/lib/pkg_resources/py31compat.py -> build/bdist.linux-x86_64/egg/pkg_resources
creating build/bdist.linux-x86_64/egg/pkg_resources/_vendor
copying build/lib/pkg_resources/_vendor/__init__.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor
copying build/lib/pkg_resources/_vendor/appdirs.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor
copying build/lib/pkg_resources/_vendor/pyparsing.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor
copying build/lib/pkg_resources/_vendor/six.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor
creating build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/__about__.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/__init__.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/_compat.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/_structures.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/markers.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/requirements.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/specifiers.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/utils.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/version.py -> build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging
creating build/bdist.linux-x86_64/egg/pkg_resources/extern
copying build/lib/pkg_resources/extern/__init__.py -> build/bdist.linux-x86_64/egg/pkg_resources/extern
creating build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/__init__.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/archive_util.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/build_meta.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/config.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/dep_util.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/depends.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/dist.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/extension.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/glibc.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/glob.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/launch.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/lib2to3_ex.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/monkey.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/msvc.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/namespaces.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/package_index.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/pep425tags.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/py27compat.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/py31compat.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/py33compat.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/py36compat.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/sandbox.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/site-patch.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/ssl_support.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/unicode_utils.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/version.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/wheel.py -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/windows_support.py -> build/bdist.linux-x86_64/egg/setuptools
creating build/bdist.linux-x86_64/egg/setuptools/_vendor
copying build/lib/setuptools/_vendor/__init__.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor
copying build/lib/setuptools/_vendor/pyparsing.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor
copying build/lib/setuptools/_vendor/six.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor
creating build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/__about__.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/__init__.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/_compat.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/_structures.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/markers.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/requirements.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/specifiers.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/utils.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
copying build/lib/setuptools/_vendor/packaging/version.py -> build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging
creating build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/__init__.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/alias.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/bdist_egg.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/bdist_rpm.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/bdist_wininst.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/build_clib.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/build_ext.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/build_py.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/develop.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/dist_info.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/easy_install.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/egg_info.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/install.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/install_egg_info.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/install_lib.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/py36compat.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/register.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/rotate.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/saveopts.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/sdist.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/setopt.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/test.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/upload.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/upload_docs.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/install_scripts.py -> build/bdist.linux-x86_64/egg/setuptools/command
copying build/lib/setuptools/command/launcher manifest.xml -> build/bdist.linux-x86_64/egg/setuptools/command
creating build/bdist.linux-x86_64/egg/setuptools/extern
copying build/lib/setuptools/extern/__init__.py -> build/bdist.linux-x86_64/egg/setuptools/extern
copying build/lib/setuptools/script (dev).tmpl -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/script.tmpl -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/cli-32.exe -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/cli-64.exe -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/cli.exe -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/gui-32.exe -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/gui-64.exe -> build/bdist.linux-x86_64/egg/setuptools
copying build/lib/setuptools/gui.exe -> build/bdist.linux-x86_64/egg/setuptools
byte-compiling build/bdist.linux-x86_64/egg/easy_install.py to easy_install.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/py31compat.py to py31compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/appdirs.py to appdirs.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/pyparsing.py to pyparsing.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/six.py to six.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/__about__.py to __about__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/_compat.py to _compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/_structures.py to _structures.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/markers.py to markers.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/requirements.py to requirements.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/specifiers.py to specifiers.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/utils.py to utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/_vendor/packaging/version.py to version.pyc
byte-compiling build/bdist.linux-x86_64/egg/pkg_resources/extern/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/archive_util.py to archive_util.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/build_meta.py to build_meta.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/config.py to config.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/dep_util.py to dep_util.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/depends.py to depends.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/dist.py to dist.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/extension.py to extension.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/glibc.py to glibc.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/glob.py to glob.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/launch.py to launch.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/lib2to3_ex.py to lib2to3_ex.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/monkey.py to monkey.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/msvc.py to msvc.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/namespaces.py to namespaces.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/package_index.py to package_index.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/pep425tags.py to pep425tags.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/py27compat.py to py27compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/py31compat.py to py31compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/py33compat.py to py33compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/py36compat.py to py36compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/sandbox.py to sandbox.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/site-patch.py to site-patch.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/ssl_support.py to ssl_support.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/unicode_utils.py to unicode_utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/version.py to version.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/wheel.py to wheel.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/windows_support.py to windows_support.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/pyparsing.py to pyparsing.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/six.py to six.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/__about__.py to __about__.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/_compat.py to _compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/_structures.py to _structures.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/markers.py to markers.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/requirements.py to requirements.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/specifiers.py to specifiers.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/utils.py to utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/_vendor/packaging/version.py to version.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/alias.py to alias.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py to bdist_egg.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/bdist_rpm.py to bdist_rpm.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/bdist_wininst.py to bdist_wininst.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/build_clib.py to build_clib.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/build_ext.py to build_ext.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/build_py.py to build_py.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/develop.py to develop.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/dist_info.py to dist_info.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py to easy_install.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/egg_info.py to egg_info.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/install.py to install.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/install_egg_info.py to install_egg_info.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/install_lib.py to install_lib.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/py36compat.py to py36compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/register.py to register.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/rotate.py to rotate.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/saveopts.py to saveopts.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/sdist.py to sdist.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/setopt.py to setopt.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/test.py to test.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/upload.py to upload.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/upload_docs.py to upload_docs.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/command/install_scripts.py to install_scripts.pyc
byte-compiling build/bdist.linux-x86_64/egg/setuptools/extern/__init__.py to __init__.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/setuptools-40.1.0.post20180820.post_20180820-py3.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing setuptools-40.1.0.post20180820.post_20180820-py3.7.egg
Removing /home/vagrant/Downloads/br/output/host/lib/python3.7/site-packages/setuptools-40.1.0.post20180820.post_20180820-py3.7.egg
Copying setuptools-40.1.0.post20180820.post_20180820-py3.7.egg to /home/vagrant/Downloads/br/output/host/lib/python3.7/site-packages
setuptools 40.1.0.post20180820.post-20180820 is already the active version in easy-install.pth
Installing easy_install script to /home/vagrant/Downloads/br/output/host/bin
Installing easy_install-3.7 script to /home/vagrant/Downloads/br/output/host/bin

Installed /home/vagrant/Downloads/br/output/host/lib/python3.7/site-packages/setuptools-40.1.0.post20180820.post_20180820-py3.7.egg
Processing dependencies for setuptools===40.1.0.post20180820.post-20180820
Finished processing dependencies for setuptools===40.1.0.post20180820.post-20180820
OK, so `python setup.py --version` uses the metadata from `setup.py`, but the version in the generated egg-info gets an extra post + date because of this in `setup.cfg`:
```
[egg_info]
tag_build = .post
tag_date = 1
```
No idea why with 40.1.0, we're getting 2 post/date added yet...
IMHO, buildroot should really use the source distributions from PyPI, rather then Github releases (which are not proper source distributions). This would also mean there's no need to run `bootstrap.py`.
And would fix the version number, even if it works with 40.0.0, the version number is not right, and confusing, considering your installing an official release, and not a development version.
Culprit is e9bdeda02a1be80d295aa8e4b068e4844141512b.
Yeah, I will try with the pypi version. Would it be possible to upload a tar.gz to pypi as well? If not, that's fine, but it would make my life much easier, as BuildRoot handles tar.gz files much easier.
It does look like using the package from pypi does indeed install as 40.1.0, so that should fix the issue in the intermittent. I'm not sure if I genuinely found a bug, but if the package on pypi had a tar.gz version, it would make my life a ton easier.
There's definitively a bug in 40.1.0, but I also think not using the PyPI source distributions is a mistake. Can you create a new issue asking for tar.gz source distributions to be added to PyPI releases please?
Done. Thank you for all of your help today!
Oy. Sorry about that. Any idea what the cause is?  I looked at the commit, and it's not obvious to me how that change causes the issue (though I fully believe it's the proximate cause).
Yes, the fact that `egg_info.egg_version` is now dynamic, combined with this:
```python
        # Set package version for the benefit of dumber commands
        # (e.g. sdist, bdist_wininst, etc.)
        #
        self.distribution.metadata.version = self.egg_version
```

Tentative patch:
```diff
 setuptools/command/egg_info.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git i/setuptools/command/egg_info.py w/setuptools/command/egg_info.py
index 5fd6c888..aba9ac6e 100644
--- i/setuptools/command/egg_info.py
+++ w/setuptools/command/egg_info.py
@@ -160,7 +160,9 @@ class egg_info(InfoCommon, Command):
 
     def initialize_options(self):
         self.egg_base = None
+        self.egg_name = None
         self.egg_info = None
+        self.egg_version = None
         self.broken_egg_info = False
 
     ####################################
@@ -188,15 +190,9 @@ def save_version_info(self, filename):
         egg_info['tag_date'] = 0
         edit_config(filename, dict(egg_info=egg_info))
 
-    @property
-    def egg_name(self):
-        return self.name
-
-    @property
-    def egg_version(self):
-        return self.tagged_version()
-
     def finalize_options(self):
+        self.egg_name = self.name
+        self.egg_version = self.tagged_version()
         parsed_version = parse_version(self.egg_version)
 
         try:
```

Resolving patch:
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -160,7 +160,9 @@ class egg_info(InfoCommon, Command):
 
     def initialize_options(self):
         self.egg_base = None
+        self.egg_name = None
         self.egg_info = None
+        self.egg_version = None
         self.broken_egg_info = False
 
     ####################################
@@ -188,15 +190,13 @@ def save_version_info(self, filename):
         egg_info['tag_date'] = 0
         edit_config(filename, dict(egg_info=egg_info))
 
-    @property
-    def egg_name(self):
-        return self.name
-
-    @property
-    def egg_version(self):
-        return self.tagged_version()
-
     def finalize_options(self):
+        # Note: we need to capture the current value returned
+        # by `self.tagged_version()`, so we can later update
+        # `self.distribution.metadata.version` without
+        # repercussions.
+        self.egg_name = self.name
+        self.egg_version = self.tagged_version()
         parsed_version = parse_version(self.egg_version)
 
         try:


Test patch:
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -570,3 +570,19 @@ def _run_egg_info_command(self, tmpdir_cwd, env, cmd=None, output=None):
             raise AssertionError(data)
         if output:
             assert output in data
+
+    def test_egg_info_tag_only_once(self, tmpdir_cwd, env):
+        self._create_project()
+        build_files({
+            'setup.cfg': DALS("""
+                              [egg_info]
+                              tag_build = dev
+                              tag_date = 0
+                              tag_svn_revision = 0
+                              """),
+        })
+        self._run_egg_info_command(tmpdir_cwd, env)
+        egg_info_dir = os.path.join('.', 'foo.egg-info')
+        with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file:
+            pkg_info_lines = pkginfo_file.read().split('\n')
+        assert 'Version: 0.0.0.dev0' in pkg_info_lines