From 0b88bbd9e98bc66b2ed2df0d020e34ddc27e3021 Mon Sep 17 00:00:00 2001 From: taleksovska Date: Wed, 15 May 2024 12:00:38 +0200 Subject: [PATCH] Change project's name in pyproject.toml file --- pyproject.toml | 2 +- setup.py | 1 + .../commands/cmd_version.py | 5 +---- src/enabler_keitaro_inc/type/semver.py | 22 +++++++++---------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ba23b11..ab7bb0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "Enabler" # noqa +name = "enabler_keitaro_inc" # noqa version = "0.1.0" # noqa description = "Enabler is a CLI application built for making life easier when working on microservice-based applications. Through this package we can create, edit and execute custom commands to configure microservices." # noqa authors = ["Your Name "] # noqa diff --git a/setup.py b/setup.py index 7d9cf8b..b408197 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ from setuptools import setup + setup( name="enabler", version="0.1.0", diff --git a/src/enabler_keitaro_inc/commands/cmd_version.py b/src/enabler_keitaro_inc/commands/cmd_version.py index 836809d..7f5c176 100644 --- a/src/enabler_keitaro_inc/commands/cmd_version.py +++ b/src/enabler_keitaro_inc/commands/cmd_version.py @@ -1,7 +1,6 @@ from src.enabler_keitaro_inc.enabler import pass_environment, logger import pkg_resources import click -from src.enabler_keitaro_inc.type.semver import BasedVersionParamType # Command to get the current Enabler version @click.group('version', short_help='Get current version of Enabler', invoke_without_command=True) # noqa @@ -11,6 +10,4 @@ def cli(ctx, kube_context_cli): """Get current version of Enabler""" distribution = pkg_resources.get_distribution("enabler") version = distribution.version - # Ensure the version string has three parts (major, minor, patch) - formatted_version = BasedVersionParamType().convert(version, None, None) - logger.info(f"Enabler {formatted_version}") + logger.info("Enabler "+version) diff --git a/src/enabler_keitaro_inc/type/semver.py b/src/enabler_keitaro_inc/type/semver.py index 7486cda..617edd3 100644 --- a/src/enabler_keitaro_inc/type/semver.py +++ b/src/enabler_keitaro_inc/type/semver.py @@ -8,15 +8,13 @@ class BasedVersionParamType(click.ParamType): def convert(self, value, param, ctx): try: parse(value) - return value - except (TypeError, ValueError): - parts = value.split('.') - if len(parts) == 2: - parts.append('0') # Default patch version to 0 if not provided - elif len(parts) == 3: - # Increment patch version for bug fixes - parts[2] = str(int(parts[2]) + 1) - else: - self.fail(f'{value!r} is not a valid version, please use semver', param, ctx) # noqa - - return '.'.join(parts) + return (value) + except TypeError: + self.fail( + '{value!r} is not a valid version, please use semver', + param, + ctx, + ) + except ValueError: + self.fail(f'{value!r} is not a valid version, please use semver', + param, ctx)