Skip to content

Commit

Permalink
Fixed adding some package versions twice when releasing.
Browse files Browse the repository at this point in the history
When releasing a package with a version pin in `[versions:python27]`
this pin would correctly get updated, but an extra pin added at the bottom.

Fixes #24
  • Loading branch information
mauritsvanrees committed Oct 26, 2019
1 parent 0214624 commit 34ae7ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions news/24.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed adding some package versions twice when releasing.
[maurits]
21 changes: 15 additions & 6 deletions plone/releaser/buildout.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,29 @@ def versions(self):
We use strict=False to avoid a DuplicateOptionError.
This happens in coredev 4.3 because we pin 'babel' and 'Babel'.
We need to combine all versions sections, like these:
['versions', 'versions:python27']
"""
config = ConfigParser(interpolation=ExtendedInterpolation(), strict=False)
with open(self.file_location) as f:
config.read_file(f)
return config["versions"]
versions = {}
for section in config.sections():
if "versions" in section.split(":"):
for package, version in config[section].items():
# Note: the package names are lower case.
versions[package] = version
return versions

def __contains__(self, package_name):
return package_name.lower() in list(self.versions.keys())
return package_name.lower() in self.versions

def __getitem__(self, package_name):
if self.__contains__(package_name):
return self.versions.get(package_name)
else:
raise KeyError
if package_name in self:
return self.versions.get(package_name.lower())
raise KeyError

def __setitem__(self, package_name, new_version):
path = os.path.join(os.getcwd(), self.file_location)
Expand Down

0 comments on commit 34ae7ba

Please sign in to comment.