Netflix / aminator

A tool for creating EBS AMIs. This tool currently works for CentOS/RedHat Linux images and is intended to run on an EC2 instance.
Apache License 2.0
950 stars 170 forks source link

Newer versions of pbr break aminator installation #220

Closed jlk closed 9 years ago

jlk commented 9 years ago

It looks like https://github.com/openstack-dev/pbr versions after 0.10.8 enforce more strict version names. This results in an error such as the following when attempting to install aminator:

# python setup.py install
Installed /usr/src/aminator/pbr-1.1.1-py2.7.egg
ERROR:root:Error parsing
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pbr/core.py", line 109, in pbr
    attrs = util.cfg_to_args(path)
  File "/usr/local/lib/python2.7/dist-packages/pbr/util.py", line 243, in cfg_to_args
    pbr.hooks.setup_hook(config)
  File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/__init__.py", line 25, in setup_hook
    metadata_config.run()
  File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/base.py", line 27, in run
    self.hook()
  File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/metadata.py", line 26, in hook
    self.config['name'], self.config.get('version', None))
  File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 651, in get_version
    version = _get_version_from_git(pre_version)
  File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 589, in _get_version_from_git
    pre_version)
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 147, in from_pip_string
    raise ValueError("Invalid version %r" % version_string)
ValueError: Invalid version 'aminator.__version__'
error in setup command: Error parsing /usr/src/aminator/setup.cfg: ValueError: Invalid version 'aminator.__version__'

Hoping for a quick workaround, I tried replacing aminator.version in setup.cfg with "2.1.65-dev," but that just resulted in

# python setup.py install
Installed /usr/src/aminator/pbr-1.1.1-py2.7.egg
ERROR:root:Error parsing
Traceback (most recent call last):
  File "/usr/src/aminator/pbr-1.1.1-py2.7.egg/pbr/core.py", line 109, in pbr
    attrs = util.cfg_to_args(path)
  File "/usr/src/aminator/pbr-1.1.1-py2.7.egg/pbr/util.py", line 243, in cfg_to_args
    pbr.hooks.setup_hook(config)
  File "/usr/src/aminator/pbr-1.1.1-py2.7.egg/pbr/hooks/__init__.py", line 25, in setup_hook
    metadata_config.run()
  File "/usr/src/aminator/pbr-1.1.1-py2.7.egg/pbr/hooks/base.py", line 27, in run
    self.hook()
  File "/usr/src/aminator/pbr-1.1.1-py2.7.egg/pbr/hooks/metadata.py", line 26, in hook
    self.config['name'], self.config.get('version', None))
  File "/usr/src/aminator/pbr-1.1.1-py2.7.egg/pbr/packaging.py", line 567, in get_version
    version = _get_version_from_git(pre_version)
  File "/usr/src/aminator/pbr-1.1.1-py2.7.egg/pbr/packaging.py", line 505, in _get_version_from_git
    pre_version)
  File "/usr/src/aminator/pbr-1.1.1-py2.7.egg/pbr/version.py", line 215, in from_pip_string
    % (remainder, version_string))
ValueError: Unknown remainder ['-dev'] in '2.1.65-dev'
error in setup command: Error parsing /usr/src/aminator/setup.cfg: ValueError: Unknown remainder ['-dev'] in '2.1.65-dev'

I can specify the pbr version in setup.py like the following, but this seems less than ideal...

setuptools.setup(setup_requires=['pbr==0.10.8'], pbr=True)

Looking for comments before I do a pull request. Seems like best way would be to update versioning to match what pbr now wants?

stevenjack commented 9 years ago

@jlk I've come across this issue too, I found that pinning the version in the requirements.txt seemed to do the trick:

https://github.com/stevenjack/aminator/blob/testing/requirements.txt#L9

although I'm not a python expert by any stretch of the imagination so I'm not sure what implications this has...

davidjoliver86 commented 9 years ago

@stevenjack That did the trick, but I also had to pip install pbr==0.10.8 before running the setup.py install.

coryb commented 9 years ago

Hey @jlk and @stevenjack @davidjoliver86 we have bumped into it ourselves. I think the "right" thing to do here is to just remove the unused/unnecessary version string in the setup.cfg. pbr will get the version from the git tag, which we keep up-to-date with the cloudbees builds.

I will put a PR together to just nuke the invalid version in the config file. -Cory

jlk commented 9 years ago

Ah nice and clean - thanks @coryb!

Lushali commented 7 years ago

I got a similar question:

Installed /private/tmp/easy_install-q9ykzG/mock-2.0.0/pbr-3.1.1-py2.7.egg
ERROR:root:Error parsing
Traceback (most recent call last):
  File "/private/tmp/easy_install-q9ykzG/mock-2.0.0/pbr-3.1.1-py2.7.egg/pbr/core.py", line 111, in pbr
    attrs = util.cfg_to_args(path, dist.script_args)
  File "/private/tmp/easy_install-q9ykzG/mock-2.0.0/pbr-3.1.1-py2.7.egg/pbr/util.py", line 251, in cfg_to_args
    kwargs = setup_cfg_to_setup_kwargs(config, script_args)
  File "/private/tmp/easy_install-q9ykzG/mock-2.0.0/pbr-3.1.1-py2.7.egg/pbr/util.py", line 434, in setup_cfg_to_setup_kwargs
    if pkg_resources.evaluate_marker('(%s)' % env_marker):
AttributeError: 'module' object has no attribute 'evaluate_marker'
error: Setup script exited with error in setup command: Error parsing /private/tmp/easy_install-q9ykzG/mock-2.0.0/setup.cfg: AttributeError: 'module' object has no attribute 'evaluate_marker'

I tried pip install pbr==3.1.1, but it's already installed Requirement already satisfied: pbr==3.1.1 in /Users/lilusha/Library/Python/2.7/lib/python/site-packages

Any ideas?