Skip to content

Commit

Permalink
Add upload-pypi option to disable upload to Pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Dec 19, 2023
1 parent c571f91 commit f873540
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions zest/releaser/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,19 @@ def create_wheel(self):
return False
return self.config.get("create-wheel", True)

def upload_pypi(self):
"""Should we upload the package to Pypi?
[Configure this mode by adding a ``upload-pypi`` option::
[zest.releaser]
upload-pypi = no
The default when this option has not been set is True.
"""
return self._get_boolean('zest.releaser', 'upload-pypi', default=True)

def register_package(self):
"""Should we try to register this package with a package server?
Expand Down
3 changes: 3 additions & 0 deletions zest/releaser/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ def _upload_distributions(self, package):
self.data["tagworkingdir"],
)
builder.build("wheel", "./dist/")
if not self.pypiconfig.upload_pypi():
logger.info("Upload to Pypi was disabled in configuration.")
return
if not self.pypiconfig.is_pypi_configured():
logger.error(
"You must have a properly configured %s file in "
Expand Down

0 comments on commit f873540

Please sign in to comment.