Skip to content

AttributeError when last tag is post release tag #126

@jaraco

Description

@jaraco

Consider this minimal example:

$ mkdir issue; cd issue
$ cat > setup.py
import setuptools
setuptools.setup(
  use_scm_version=True,
  setup_requires=['setuptools_scm==1.15.0'],
)
$ hg init .
$ hg add setup.py
$ hg ci -m "Simple project"
$ hg tag 23.24post22+deadbeef
$ python setup.py egg_info
running egg_info
creating UNKNOWN.egg-info
writing UNKNOWN.egg-info/PKG-INFO
writing dependency_links to UNKNOWN.egg-info/dependency_links.txt
writing top-level names to UNKNOWN.egg-info/top_level.txt
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
$ cat UNKNOWN.egg-info/PKG-INFO| grep Version
Metadata-Version: 1.0
Version: 23.24.post22+deadbeef
$ touch foo
$ hg add foo
$ hg ci -m "Adding foo"
$ python setup.py egg_info                   
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    setup_requires=['setuptools_scm==1.15.0'],
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/dist.py", line 318, in __init__
    _Distribution.__init__(self, attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 281, in __init__
    self.finalize_options()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/dist.py", line 376, in finalize_options
    ep.load()(self, ep.name, value)
  File "/Users/jaraco/Dropbox/code/public/setuptools_scm/issue/.eggs/setuptools_scm-1.15.0-py3.6.egg/setuptools_scm/integration.py", line 19, in version_keyword
  File "/Users/jaraco/Dropbox/code/public/setuptools_scm/issue/.eggs/setuptools_scm-1.15.0-py3.6.egg/setuptools_scm/__init__.py", line 123, in get_version
  File "/Users/jaraco/Dropbox/code/public/setuptools_scm/issue/.eggs/setuptools_scm-1.15.0-py3.6.egg/setuptools_scm/version.py", line 133, in format_version
  File "/Users/jaraco/Dropbox/code/public/setuptools_scm/issue/.eggs/setuptools_scm-1.15.0-py3.6.egg/setuptools_scm/version.py", line 105, in guess_next_dev_version
  File "/Users/jaraco/Dropbox/code/public/setuptools_scm/issue/.eggs/setuptools_scm-1.15.0-py3.6.egg/setuptools_scm/version.py", line 97, in guess_next_version
AttributeError: 'NoneType' object has no attribute 'groups'
$                                            

The regex on line 97 fails to match the tag 23.24post22+deadbeef.

Is it possible that regex could be more lenient, or that tags that don't match the expected pattern should be ignored?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions