diff --git a/mypy_boto3_builder/cli_parser.py b/mypy_boto3_builder/cli_parser.py index 5def9f35a..316e32a58 100644 --- a/mypy_boto3_builder/cli_parser.py +++ b/mypy_boto3_builder/cli_parser.py @@ -76,8 +76,12 @@ def parse_args(args: Sequence[str]) -> Namespace: ) parser.add_argument( "--no-smart-version", - action="store_true", - help="Disable version bump if package is already published", + action="store_false", + help=( + "Disable version bump based od last PyPI version. " + "Set this flag to run packages build in offline mode. " + "skip-published flag is ignored in this case." + ), ) parser.add_argument( "--panic", diff --git a/mypy_boto3_builder/generators/base_generator.py b/mypy_boto3_builder/generators/base_generator.py index 105fa5f2e..0e76d890c 100644 --- a/mypy_boto3_builder/generators/base_generator.py +++ b/mypy_boto3_builder/generators/base_generator.py @@ -27,7 +27,7 @@ class BaseGenerator(ABC): output_path -- Path to write generated files generate_setup -- Whether to create package or installed module skip_published -- Whether to skip packages that are already published - disable_smart_version -- Whether to create a new postrelease if version is already published + disable_smart_version -- Whether to create a new postrelease based on latest PyPI version version -- Package build version """ @@ -68,6 +68,8 @@ def get_library_version(self) -> str: raise NotImplementedError() def _get_package_version(self, pypi_name: str, version: str) -> str | None: + if self.disable_smart_version: + return version pypi_manager = PyPIManager(pypi_name) if not pypi_manager.has_version(version): return version @@ -75,8 +77,6 @@ def _get_package_version(self, pypi_name: str, version: str) -> str | None: if self.skip_published: self.logger.info(f"Skipping {pypi_name} {version}, already on PyPI") return None - if self.disable_smart_version: - return version return pypi_manager.get_next_version(version)