2021.4 #19
@ -8,35 +8,35 @@ class VersionSettings(ConfigurationModelABC):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
major: int = None,
|
major: str = None,
|
||||||
minor: int = None,
|
minor: str = None,
|
||||||
micro: float = None
|
micro: str = None
|
||||||
):
|
):
|
||||||
ConfigurationModelABC.__init__(self)
|
ConfigurationModelABC.__init__(self)
|
||||||
|
|
||||||
self._major: Optional[int] = major
|
self._major: Optional[str] = major
|
||||||
self._minor: Optional[int] = minor
|
self._minor: Optional[str] = minor
|
||||||
self._micro: Optional[int] = micro
|
self._micro: Optional[str] = micro
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def major(self) -> int:
|
def major(self) -> str:
|
||||||
return self._major
|
return self._major
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def minor(self) -> int:
|
def minor(self) -> str:
|
||||||
return self._minor
|
return self._minor
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def micro(self) -> float:
|
def micro(self) -> str:
|
||||||
return self._micro
|
return self._micro
|
||||||
|
|
||||||
def to_str(self) -> str:
|
def to_str(self) -> str:
|
||||||
return f'{self._major}.{self._minor}.{self._micro}'
|
return f'{self._major}.{self._minor}.{self._micro}'
|
||||||
|
|
||||||
def from_dict(self, settings: dict):
|
def from_dict(self, settings: dict):
|
||||||
self._major = int(settings[VersionSettingsNameEnum.major.value])
|
self._major = settings[VersionSettingsNameEnum.major.value]
|
||||||
self._minor = int(settings[VersionSettingsNameEnum.minor.value])
|
self._minor = settings[VersionSettingsNameEnum.minor.value]
|
||||||
self._micro = int(settings[VersionSettingsNameEnum.micro.value])
|
self._micro = settings[VersionSettingsNameEnum.micro.value]
|
||||||
|
|
||||||
def to_dict(self) -> dict:
|
def to_dict(self) -> dict:
|
||||||
return {
|
return {
|
||||||
|
@ -235,7 +235,7 @@ class PublisherService(PublisherABC):
|
|||||||
return paths
|
return paths
|
||||||
|
|
||||||
def _create_setup(self):
|
def _create_setup(self):
|
||||||
setup_file = os.path.join(self._output_path, 'setup_template.py')
|
setup_file = os.path.join(self._output_path, 'setup.py')
|
||||||
if os.path.isfile(setup_file):
|
if os.path.isfile(setup_file):
|
||||||
os.remove(setup_file)
|
os.remove(setup_file)
|
||||||
|
|
||||||
@ -273,9 +273,9 @@ class PublisherService(PublisherABC):
|
|||||||
setup_py.close()
|
setup_py.close()
|
||||||
|
|
||||||
def _run_setup(self):
|
def _run_setup(self):
|
||||||
setup_py = os.path.join(self._output_path, 'setup_template.py')
|
setup_py = os.path.join(self._output_path, 'setup.py')
|
||||||
if not os.path.isfile(setup_py):
|
if not os.path.isfile(setup_py):
|
||||||
Console.error(__name__, f'setup_template.py not found in {self._output_path}')
|
Console.error(__name__, f'setup.py not found in {self._output_path}')
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -288,7 +288,7 @@ class PublisherService(PublisherABC):
|
|||||||
])
|
])
|
||||||
os.remove(setup_py)
|
os.remove(setup_py)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Console.error('Executing setup_template.py failed', str(e))
|
Console.error('Executing setup.py failed', str(e))
|
||||||
|
|
||||||
def include(self, path: str):
|
def include(self, path: str):
|
||||||
self._build_settings.included.append(path)
|
self._build_settings.included.append(path)
|
||||||
@ -312,7 +312,7 @@ class PublisherService(PublisherABC):
|
|||||||
Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
Console.spinner('Building application:', self._dist_files, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||||
|
|
||||||
Console.write_line('\nPublish:')
|
Console.write_line('\nPublish:')
|
||||||
Console.spinner('Generating setup_template.py:', self._create_setup, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
Console.spinner('Generating setup.py:', self._create_setup, text_foreground_color=ForegroundColorEnum.green, spinner_foreground_color=ForegroundColorEnum.blue)
|
||||||
Console.write_line('Running setup_template.py:\n')
|
Console.write_line('Running setup.py:\n')
|
||||||
self._run_setup()
|
self._run_setup()
|
||||||
# Console.spinner('Cleaning dist path:', self._clean_dist_files)
|
# Console.spinner('Cleaning dist path:', self._clean_dist_files)
|
||||||
|
Loading…
Reference in New Issue
Block a user