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: fix regression with egg_info command #1465

Merged
merged 1 commit into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1465.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression with `egg_info` command when tagging is used.
16 changes: 8 additions & 8 deletions setuptools/command/egg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

####################################
Expand Down Expand Up @@ -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:
Expand Down
16 changes: 16 additions & 0 deletions setuptools/tests/test_egg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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