From 363fef9b5341db68dff46c513688dc5cd90205fb Mon Sep 17 00:00:00 2001 From: Bartek Sokorski Date: Fri, 16 Dec 2022 22:28:04 +0100 Subject: [PATCH] Add an option to set ouput directory on build --- docs/cli.md | 1 + poetry.lock | 16 ++++++++++------ pyproject.toml | 3 ++- src/poetry/console/commands/build.py | 5 +++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index a4c682a757d..8bc910c3faa 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -503,6 +503,7 @@ Note that, at the moment, only pure python wheels are supported. ### Options * `--format (-f)`: Limit the format to either `wheel` or `sdist`. +* `--output (-o)`: Set output directory for build artifacts. ## publish diff --git a/poetry.lock b/poetry.lock index 7f5a98bdbc7..18a935b3ebf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -975,15 +975,19 @@ version = "1.4.0" description = "Poetry PEP 517 Build Backend" category = "main" optional = false -python-versions = ">=3.7,<4.0" -files = [ - {file = "poetry_core-1.4.0-py3-none-any.whl", hash = "sha256:5559ab80384ac021db329ef317086417e140ee1176bcfcb3a3838b544e213c8e"}, - {file = "poetry_core-1.4.0.tar.gz", hash = "sha256:514bd33c30e0bf56b0ed44ee15e120d7e47b61ad908b2b1011da68c48a84ada9"}, -] +python-versions = "^3.7" +files = [] +develop = false [package.dependencies] importlib-metadata = {version = ">=1.7.0", markers = "python_version < \"3.8\""} +[package.source] +type = "git" +url = "https://github.com/python-poetry/poetry-core" +reference = "main" +resolved_reference = "4f7d44a2dfc2527a22b5c3f69e867e5f2e6e1908" + [[package]] name = "poetry-plugin-export" version = "1.2.0" @@ -1798,4 +1802,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "bbc71952916c7ee1c404e4a85e611189347955d63d5560b5bdb23073a07afde6" +content-hash = "8a31ab242dcb36256e49650769dfdb7fb3732842ac29dde1ddf326e2ba8bfddb" diff --git a/pyproject.toml b/pyproject.toml index 88a46ec4ecf..1f1e556f7d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,8 @@ generate-setup-file = false [tool.poetry.dependencies] python = "^3.7" -poetry-core = "1.4.0" +# subject to change after poetry-core is released +poetry-core = {git = "https://github.com/python-poetry/poetry-core", branch = "main"} poetry-plugin-export = "^1.2.0" "backports.cached-property" = { version = "^1.0.2", python = "<3.8" } cachecontrol = { version = "^0.12.9", extras = ["filecache"] } diff --git a/src/poetry/console/commands/build.py b/src/poetry/console/commands/build.py index 5339a865200..1fdeb38083f 100644 --- a/src/poetry/console/commands/build.py +++ b/src/poetry/console/commands/build.py @@ -11,7 +11,8 @@ class BuildCommand(EnvCommand): description = "Builds a package, as a tarball and a wheel by default." options = [ - option("format", "f", "Limit the format to either sdist or wheel.", flag=False) + option("format", "f", "Limit the format to either sdist or wheel.", flag=False), + option("output", "o", "Set output directory name", flag=False, default="dist"), ] loggers = [ @@ -31,6 +32,6 @@ def handle(self) -> int: ) builder = Builder(self.poetry) - builder.build(fmt, executable=env.python) + builder.build(fmt, executable=env.python, target_dir=self.option("output")) return 0