2021.4.1 #11
3
cpl.json
3
cpl.json
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2021",
|
"Major": "2021",
|
||||||
"Minor": "04",
|
"Minor": "04",
|
||||||
"Micro": "01-1"
|
"Micro": "01-2"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
@ -27,6 +27,7 @@
|
|||||||
"watchdog==2.0.2"
|
"watchdog==2.0.2"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.8",
|
"PythonVersion": ">=3.8",
|
||||||
|
"PythonPath": "",
|
||||||
"Classifiers": []
|
"Classifiers": []
|
||||||
},
|
},
|
||||||
"BuildSettings": {
|
"BuildSettings": {
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'sh_cpl.cpl'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.application'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -28,4 +28,4 @@ from .application_runtime_abc import ApplicationRuntimeABC
|
|||||||
from .startup_abc import StartupABC
|
from .startup_abc import StartupABC
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.configuration'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -27,4 +27,4 @@ from .configuration_variable_name_enum import ConfigurationVariableNameEnum
|
|||||||
from .console_argument import ConsoleArgument
|
from .console_argument import ConsoleArgument
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.console'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -27,4 +27,4 @@ from .foreground_color_enum import ForegroundColorEnum
|
|||||||
from .spinner_thread import SpinnerThread
|
from .spinner_thread import SpinnerThread
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.database'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -25,4 +25,4 @@ from .database_settings import DatabaseSettings
|
|||||||
from .database_settings_name_enum import DatabaseSettingsNameEnum
|
from .database_settings_name_enum import DatabaseSettingsNameEnum
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.database.connection'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ from .database_connection import DatabaseConnection
|
|||||||
from .database_connection_abc import DatabaseConnectionABC
|
from .database_connection_abc import DatabaseConnectionABC
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.database.context'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ from .database_context import DatabaseContext
|
|||||||
from .database_context_abc import DatabaseContextABC
|
from .database_context_abc import DatabaseContextABC
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.dependency_injection'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -25,4 +25,4 @@ from .service_provider import ServiceProvider
|
|||||||
from .service_provider_abc import ServiceProviderABC
|
from .service_provider_abc import ServiceProviderABC
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.environment'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -25,4 +25,4 @@ from .environment_name_enum import EnvironmentNameEnum
|
|||||||
from .application_environment import ApplicationEnvironment
|
from .application_environment import ApplicationEnvironment
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.logging'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -27,4 +27,4 @@ from .logging_settings import LoggingSettings
|
|||||||
from .logging_settings_name_enum import LoggingSettingsNameEnum
|
from .logging_settings_name_enum import LoggingSettingsNameEnum
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.mailing'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -27,4 +27,4 @@ from .email_client_settings import EMailClientSettings
|
|||||||
from .email_client_settings_name_enum import EMailClientSettingsNameEnum
|
from .email_client_settings_name_enum import EMailClientSettingsNameEnum
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl.time'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ from .time_format_settings import TimeFormatSettings
|
|||||||
from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum
|
from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,13 +15,14 @@ __title__ = 'cpl.utils'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
from .credential_manager import CredentialManager
|
from .credential_manager import CredentialManager
|
||||||
from .string import String
|
from .string import String
|
||||||
|
from .pip import Pip
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -5,12 +5,38 @@ from typing import Optional
|
|||||||
|
|
||||||
|
|
||||||
class Pip:
|
class Pip:
|
||||||
|
_executable = sys.executable
|
||||||
|
|
||||||
@staticmethod
|
"""
|
||||||
def get_package(package: str) -> Optional[str]:
|
Getter
|
||||||
|
"""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_executable(cls) -> str:
|
||||||
|
return cls._executable
|
||||||
|
|
||||||
|
"""
|
||||||
|
Setter
|
||||||
|
"""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def set_executable(cls, executable: str):
|
||||||
|
if executable is not None:
|
||||||
|
cls._executable = executable
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def reset_executable(cls):
|
||||||
|
cls._executable = sys.executable
|
||||||
|
|
||||||
|
"""
|
||||||
|
Public utils functions
|
||||||
|
"""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_package(cls, package: str) -> Optional[str]:
|
||||||
result = None
|
result = None
|
||||||
with suppress(Exception):
|
with suppress(Exception):
|
||||||
result = subprocess.check_output([sys.executable, "-m", "pip", "show", package], stderr=subprocess.DEVNULL)
|
result = subprocess.check_output([cls._executable, "-m", "pip", "show", package], stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
if result is None:
|
if result is None:
|
||||||
return None
|
return None
|
||||||
@ -24,9 +50,13 @@ class Pip:
|
|||||||
|
|
||||||
return f'{package}=={new_version}'
|
return f'{package}=={new_version}'
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def install(package: str, *args, source: str = None, stdout=None, stderr=None):
|
def get_outdated(cls) -> bytes:
|
||||||
pip_args = [sys.executable, "-m", "pip", "install"]
|
return subprocess.check_output([cls._executable, "-m", "pip", "list", "--outdated"])
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def install(cls, package: str, *args, source: str = None, stdout=None, stderr=None, admin=None):
|
||||||
|
pip_args = [cls._executable, "-m", "pip", "install"]
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
pip_args.append(arg)
|
pip_args.append(arg)
|
||||||
@ -38,6 +68,6 @@ class Pip:
|
|||||||
pip_args.append(package)
|
pip_args.append(package)
|
||||||
subprocess.run(pip_args, stdout=stdout, stderr=stderr)
|
subprocess.run(pip_args, stdout=stdout, stderr=stderr)
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def uninstall(package: str, stdout=None, stderr=None):
|
def uninstall(cls, package: str, stdout=None, stderr=None):
|
||||||
subprocess.run([sys.executable, "-m", "pip", "uninstall", "--yes", package], stdout=stdout, stderr=stderr)
|
subprocess.run([cls._executable, "-m", "pip", "uninstall", "--yes", package], stdout=stdout, stderr=stderr)
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'sh_cpl.cpl_cli'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -29,4 +29,4 @@ from .main import main
|
|||||||
from .startup import Startup
|
from .startup import Startup
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -28,4 +28,4 @@ from .publish_service import PublishService
|
|||||||
from .version_service import VersionService
|
from .version_service import VersionService
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from cpl.application import ApplicationRuntimeABC
|
from cpl.application import ApplicationRuntimeABC
|
||||||
from cpl.configuration import ConfigurationABC
|
from cpl.configuration import ConfigurationABC
|
||||||
@ -85,6 +83,7 @@ class InstallService(CommandABC):
|
|||||||
is_already_in_project = False
|
is_already_in_project = False
|
||||||
project: ProjectSettings = self._config.get_configuration(ProjectSettings)
|
project: ProjectSettings = self._config.get_configuration(ProjectSettings)
|
||||||
build: BuildSettings = self._config.get_configuration(BuildSettings)
|
build: BuildSettings = self._config.get_configuration(BuildSettings)
|
||||||
|
Pip.set_executable(project.python_path)
|
||||||
|
|
||||||
if project is None or build is None:
|
if project is None or build is None:
|
||||||
Error.error('The command requires to be run in an CPL project, but a project could not be found.')
|
Error.error('The command requires to be run in an CPL project, but a project could not be found.')
|
||||||
@ -128,6 +127,8 @@ class InstallService(CommandABC):
|
|||||||
project_file.write(json.dumps(config, indent=2))
|
project_file.write(json.dumps(config, indent=2))
|
||||||
project_file.close()
|
project_file.close()
|
||||||
|
|
||||||
|
Pip.reset_executable()
|
||||||
|
|
||||||
def run(self, args: list[str]):
|
def run(self, args: list[str]):
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
self._install_project()
|
self._install_project()
|
||||||
|
@ -64,6 +64,8 @@ class UninstallService(CommandABC):
|
|||||||
Console.error(f'Usage: cpl uninstall <package>')
|
Console.error(f'Usage: cpl uninstall <package>')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Pip.set_executable(self._project_settings.python_path)
|
||||||
|
|
||||||
package = args[0]
|
package = args[0]
|
||||||
is_in_dependencies = False
|
is_in_dependencies = False
|
||||||
|
|
||||||
@ -101,6 +103,4 @@ class UninstallService(CommandABC):
|
|||||||
project_file.close()
|
project_file.close()
|
||||||
|
|
||||||
Console.write_line(f'Removed {package}')
|
Console.write_line(f'Removed {package}')
|
||||||
|
Pip.reset_executable()
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,15 +20,7 @@ class UpdateService(CommandABC):
|
|||||||
self._project_settings = project_settings
|
self._project_settings = project_settings
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_outdated() -> bytes:
|
def _install_package(name: str):
|
||||||
return subprocess.check_output([sys.executable, "-m", "pip", "list", "--outdated"])
|
|
||||||
|
|
||||||
def _update_project_dependencies(self):
|
|
||||||
for package in self._project_settings.dependencies:
|
|
||||||
name = package
|
|
||||||
if '==' in package:
|
|
||||||
name = package.split('==')[0]
|
|
||||||
|
|
||||||
if 'sh_cpl' in name:
|
if 'sh_cpl' in name:
|
||||||
Pip.install(
|
Pip.install(
|
||||||
name,
|
name,
|
||||||
@ -49,9 +41,17 @@ class UpdateService(CommandABC):
|
|||||||
stderr=subprocess.DEVNULL
|
stderr=subprocess.DEVNULL
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _update_project_dependencies(self):
|
||||||
|
for package in self._project_settings.dependencies:
|
||||||
|
name = package
|
||||||
|
if '==' in package:
|
||||||
|
name = package.split('==')[0]
|
||||||
|
|
||||||
|
self._install_package(name)
|
||||||
|
|
||||||
new_package = Pip.get_package(name)
|
new_package = Pip.get_package(name)
|
||||||
if new_package is None:
|
if new_package is None:
|
||||||
Console.error(f'Invalid name: {name}')
|
Console.error(f'Update for package {package} failed')
|
||||||
return
|
return
|
||||||
|
|
||||||
self._project_json_update_dependency(package, new_package)
|
self._project_json_update_dependency(package, new_package)
|
||||||
@ -64,9 +64,10 @@ class UpdateService(CommandABC):
|
|||||||
)
|
)
|
||||||
Console.write_line(f'Found {len(self._project_settings.dependencies)} dependencies.')
|
Console.write_line(f'Found {len(self._project_settings.dependencies)} dependencies.')
|
||||||
|
|
||||||
def _check_outdated(self):
|
@staticmethod
|
||||||
|
def _check_outdated():
|
||||||
table_str: bytes = Console.spinner(
|
table_str: bytes = Console.spinner(
|
||||||
'Analyzing for available package updates', self._get_outdated,
|
'Analyzing for available package updates', Pip.get_outdated,
|
||||||
text_foreground_color=ForegroundColorEnum.green,
|
text_foreground_color=ForegroundColorEnum.green,
|
||||||
spinner_foreground_color=ForegroundColorEnum.cyan
|
spinner_foreground_color=ForegroundColorEnum.cyan
|
||||||
)
|
)
|
||||||
@ -78,7 +79,7 @@ class UpdateService(CommandABC):
|
|||||||
Console.write_line(f'\t{row}')
|
Console.write_line(f'\t{row}')
|
||||||
|
|
||||||
Console.set_foreground_color(ForegroundColorEnum.yellow)
|
Console.set_foreground_color(ForegroundColorEnum.yellow)
|
||||||
Console.write_line(f'\tUpdate with {sys.executable} -m pip install --upgrade <package>')
|
Console.write_line(f'\tUpdate with {Pip.get_executable()} -m pip install --upgrade <package>')
|
||||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||||
|
|
||||||
def _project_json_update_dependency(self, old_package: str, new_package: str):
|
def _project_json_update_dependency(self, old_package: str, new_package: str):
|
||||||
@ -98,8 +99,9 @@ class UpdateService(CommandABC):
|
|||||||
project.close()
|
project.close()
|
||||||
|
|
||||||
def run(self, args: list[str]):
|
def run(self, args: list[str]):
|
||||||
# target update discord 1.5.1 to discord 1.6.0
|
Pip.set_executable(self._project_settings.python_path)
|
||||||
self._check_project_dependencies()
|
self._check_project_dependencies()
|
||||||
self._check_outdated()
|
self._check_outdated()
|
||||||
|
Pip.reset_executable()
|
||||||
|
|
||||||
Console.write('\n')
|
Console.write('\n')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -28,4 +28,4 @@ from .version_settings import VersionSettings
|
|||||||
from .version_settings_name_enum import VersionSettingsNameEnum
|
from .version_settings_name_enum import VersionSettingsNameEnum
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ class ProjectSettings(ConfigurationModelABC):
|
|||||||
self._license_description: Optional[str] = None
|
self._license_description: Optional[str] = None
|
||||||
self._dependencies: Optional[list[str]] = None
|
self._dependencies: Optional[list[str]] = None
|
||||||
self._python_version: Optional[str] = None
|
self._python_version: Optional[str] = None
|
||||||
|
self._python_path: Optional[str] = None
|
||||||
self._classifiers: Optional[list[str]] = None
|
self._classifiers: Optional[list[str]] = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -80,6 +83,10 @@ class ProjectSettings(ConfigurationModelABC):
|
|||||||
def python_version(self) -> str:
|
def python_version(self) -> str:
|
||||||
return self._python_version
|
return self._python_version
|
||||||
|
|
||||||
|
@property
|
||||||
|
def python_path(self) -> str:
|
||||||
|
return self._python_path
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def classifiers(self) -> list[str]:
|
def classifiers(self) -> list[str]:
|
||||||
return self._classifiers
|
return self._classifiers
|
||||||
@ -99,6 +106,15 @@ class ProjectSettings(ConfigurationModelABC):
|
|||||||
self._license_description = settings[ProjectSettingsNameEnum.license_description.value]
|
self._license_description = settings[ProjectSettingsNameEnum.license_description.value]
|
||||||
self._dependencies = settings[ProjectSettingsNameEnum.dependencies.value]
|
self._dependencies = settings[ProjectSettingsNameEnum.dependencies.value]
|
||||||
self._python_version = settings[ProjectSettingsNameEnum.python_version.value]
|
self._python_version = settings[ProjectSettingsNameEnum.python_version.value]
|
||||||
|
|
||||||
|
path = os.path.abspath(settings[ProjectSettingsNameEnum.python_path.value])
|
||||||
|
if os.path.isfile(path) or os.path.islink(path):
|
||||||
|
path = os.path.abspath(path)
|
||||||
|
else:
|
||||||
|
path = sys.executable
|
||||||
|
|
||||||
|
self._python_path = path
|
||||||
|
|
||||||
self._classifiers = settings[ProjectSettingsNameEnum.classifiers.value]
|
self._classifiers = settings[ProjectSettingsNameEnum.classifiers.value]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Console.set_foreground_color(ForegroundColorEnum.red)
|
Console.set_foreground_color(ForegroundColorEnum.red)
|
||||||
|
@ -15,4 +15,5 @@ class ProjectSettingsNameEnum(Enum):
|
|||||||
license_description = 'LicenseDescription'
|
license_description = 'LicenseDescription'
|
||||||
dependencies = 'Dependencies'
|
dependencies = 'Dependencies'
|
||||||
python_version = 'PythonVersion'
|
python_version = 'PythonVersion'
|
||||||
|
python_path = 'PythonPath'
|
||||||
classifiers = 'Classifiers'
|
classifiers = 'Classifiers'
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.live_server'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ from .publisher_abc import PublisherABC
|
|||||||
from .publisher_service import PublisherService
|
from .publisher_service import PublisherService
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.build'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.generate'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.new'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.new.console'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.new.console.src'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.new.console.src.tests'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_cli.templates.publish'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4.1.post1'
|
__version__ = '2021.4.1.post2'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='04', micro='01-1')
|
version_info = VersionInfo(major='2021', minor='04', micro='01-2')
|
||||||
|
@ -16,9 +16,10 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"sh_cpl==2021.4.1"
|
"sh_cpl==2021.4.1.post2"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.8",
|
"PythonVersion": ">=3.8",
|
||||||
|
"PythonPath": "../../../../cpl-env/bin/python3.9",
|
||||||
"Classifiers": []
|
"Classifiers": []
|
||||||
},
|
},
|
||||||
"BuildSettings": {
|
"BuildSettings": {
|
||||||
|
Loading…
Reference in New Issue
Block a user