-
Notifications
You must be signed in to change notification settings - Fork 104
Description
Reproducer:
- run a system with virtualenv 1.7.1.2 (in my case, a Vagrant box based on debian/wheezy64)
- create a Python 2.7 virtual environment (
virtualenv venv) - activate the environment (
source venv/bin/activate) - upgrade pip (
pip install --upgrade pip) - follow the mock's installation instructions (I did not find any, thus
pip install mock) - import mock (
python -c "import mock")
Actual behavior:
An Exception with the following traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/vagrant/venv/local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
import mock.mock as _mock
File "/home/vagrant/venv/local/lib/python2.7/site-packages/mock/mock.py", line 71, in <module>
_v = VersionInfo('mock').semantic_version()
File "/home/vagrant/venv/local/lib/python2.7/site-packages/pbr/version.py", line 460, in semantic_version
self._semantic = self._get_version_from_pkg_resources()
File "/home/vagrant/venv/local/lib/python2.7/site-packages/pbr/version.py", line 447, in _get_version_from_pkg_resources
result_string = packaging.get_version(self.package)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/pbr/packaging.py", line 725, in get_version
raise Exception("Versioning for this project requires either an sdist"
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed
Expected behavior:
mock can be imported
Affected versions:
- mock 2.0.0
- pbr 1.10.0
- pip 8.1.2
- distribute 0.6.24
- Python 2.7
Additional information
An upgrade of setuptools (pip install --upgrade pip) (to 28.6.1) after the installation of mock does not fix the issue. An upgrade before the installation helps.
Normally, I don't use these old libraries but I am forced to be compatible with Python 2.6 and Debian Wheezy seems to be the last Debian release that has Python 2.6 in its official repositories. Since I use that system only for testing and not for development, the provisioning of the system is automated (via Vagrant). Thus the steps above. Normally, I wouldn't even upgrade pip but I could not install mock without that.
What I want to say is that I understand that you expect users to use newer versions. But in such automated cases, it might not be the case. If you (or pbr - I don't know which package caused that) could enforce newer setuptools, it would really help. If not, at least a note in installation instructions would be nice.
Maybe this is a duplicate of #314. Maybe this is even a duplicate of https://bugs.launchpad.net/pbr/+bug/1505007. However, since the pbr bug is open for 1 year already without any response, it might be reasonable to implement a workaround in mock in the meantime.