"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "poetry/console/commands/publish.py" between
poetry-1.1.15.tar.gz and poetry-1.2.0.tar.gz

About: Poetry is a tool for dependency management and packaging in Python.

publish.py  (poetry-1.1.15):publish.py  (poetry-1.2.0)
from cleo import option from __future__ import annotations
from poetry.utils._compat import Path from pathlib import Path
from .command import Command from cleo.helpers import option
class PublishCommand(Command): from poetry.console.commands.command import Command
class PublishCommand(Command):
name = "publish" name = "publish"
description = "Publishes a package to a remote repository." description = "Publishes a package to a remote repository."
options = [ options = [
option( option(
"repository", "r", "The repository to publish the package to.", flag =False "repository", "r", "The repository to publish the package to.", flag =False
), ),
option("username", "u", "The username to access the repository.", flag=F alse), option("username", "u", "The username to access the repository.", flag=F alse),
option("password", "p", "The password to access the repository.", flag=F alse), option("password", "p", "The password to access the repository.", flag=F alse),
option( option(
"cert", None, "Certificate authority to access the repository.", fla g=False "cert", None, "Certificate authority to access the repository.", fla g=False
), ),
option( option(
"client-cert", "client-cert",
None, None,
"Client certificate to access the repository.", "Client certificate to access the repository.",
flag=False, flag=False,
), ),
option("build", None, "Build the package before publishing."), option("build", None, "Build the package before publishing."),
option("dry-run", None, "Perform all actions except upload the package." ), option("dry-run", None, "Perform all actions except upload the package." ),
option(
"skip-existing",
None,
"Ignore errors from files already existing in the repository.",
),
] ]
help = """The publish command builds and uploads the package to a remote rep ository. help = """The publish command builds and uploads the package to a remote rep ository.
By default, it will upload to PyPI but if you pass the --repository option it wi ll By default, it will upload to PyPI but if you pass the --repository option it wi ll
upload to it instead. upload to it instead.
The --repository option should match the name of a configured repository using The --repository option should match the name of a configured repository using
the config command. the config command.
""" """
loggers = ["poetry.masonry.publishing.publisher"] loggers = ["poetry.masonry.publishing.publisher"]
def handle(self): def handle(self) -> int:
from poetry.publishing.publisher import Publisher from poetry.publishing.publisher import Publisher
publisher = Publisher(self.poetry, self.io) publisher = Publisher(self.poetry, self.io)
# Building package first, if told # Building package first, if told
if self.option("build"): if self.option("build"):
if publisher.files: if publisher.files and not self.confirm(
if not self.confirm( f"There are <info>{len(publisher.files)}</info> files ready for"
"There are <info>{}</info> files ready for publishing. " " publishing. Build anyway?"
"Build anyway?".format(len(publisher.files)) ):
): self.line_error("<error>Aborted!</error>")
self.line_error("<error>Aborted!</error>")
return 1 return 1
self.call("build") self.call("build")
files = publisher.files files = publisher.files
if not files: if not files:
self.line_error( self.line_error(
"<error>No files to publish. " "<error>No files to publish. "
"Run poetry build first or use the --build option.</error>" "Run poetry build first or use the --build option.</error>"
) )
skipping to change at line 83 skipping to change at line 88
Path(self.option("client-cert")) if self.option("client-cert") else None Path(self.option("client-cert")) if self.option("client-cert") else None
) )
publisher.publish( publisher.publish(
self.option("repository"), self.option("repository"),
self.option("username"), self.option("username"),
self.option("password"), self.option("password"),
cert, cert,
client_cert, client_cert,
self.option("dry-run"), self.option("dry-run"),
self.option("skip-existing"),
) )
return 0
 End of changes. 11 change blocks. 
12 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)