Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust no-smart-version option to enable offline builds #225

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions mypy_boto3_builder/cli_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions mypy_boto3_builder/generators/base_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand Down Expand Up @@ -68,15 +68,15 @@ 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

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)

Expand Down