Fixed update & install commands #113 #115
@ -112,7 +112,7 @@
|
|||||||
"de": "cpl deploy-exp $ARGS",
|
"de": "cpl deploy-exp $ARGS",
|
||||||
"deploy-exp-cli": "cpl publish-cli; cpl upload-exp-cli",
|
"deploy-exp-cli": "cpl publish-cli; cpl upload-exp-cli",
|
||||||
"deploy-exp-core": "cpl publish-core; cpl upload-exp-core",
|
"deploy-exp-core": "cpl publish-core; cpl upload-exp-core",
|
||||||
"deploy-exp-discord": "cpl publish-discord; #pl upload-exp-discord",
|
"deploy-exp-discord": "cpl publish-discord; cpl upload-exp-discord",
|
||||||
"deploy-exp-query": "cpl publish-query; cpl upload-exp-query",
|
"deploy-exp-query": "cpl publish-query; cpl upload-exp-query",
|
||||||
"deploy-exp-translation": "cpl publish-translation; cpl upload-exp-translation",
|
"deploy-exp-translation": "cpl publish-translation; cpl upload-exp-translation",
|
||||||
|
|
||||||
|
@ -76,23 +76,33 @@ class InstallService(CommandABC):
|
|||||||
Console.spinner(
|
Console.spinner(
|
||||||
f'Installing: {dependency}',
|
f'Installing: {dependency}',
|
||||||
Pip.install if not self._is_virtual else self._wait, dependency if not self._is_virtual else 2,
|
Pip.install if not self._is_virtual else self._wait, dependency if not self._is_virtual else 2,
|
||||||
source=self._cli_settings.pip_path if 'cpl-' in dependency else None,
|
'--upgrade',
|
||||||
|
source=self._cli_settings.pip_path,
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
text_foreground_color=ForegroundColorEnum.green,
|
text_foreground_color=ForegroundColorEnum.green,
|
||||||
spinner_foreground_color=ForegroundColorEnum.cyan
|
spinner_foreground_color=ForegroundColorEnum.cyan
|
||||||
)
|
)
|
||||||
|
local_package = Pip.get_package(dependency)
|
||||||
|
if local_package is None:
|
||||||
|
Error.warn(f'Installation of package {dependency} failed!')
|
||||||
|
return
|
||||||
|
|
||||||
for dependency in self._project_settings.dev_dependencies:
|
for dependency in self._project_settings.dev_dependencies:
|
||||||
Console.spinner(
|
Console.spinner(
|
||||||
f'Installing dev: {dependency}',
|
f'Installing dev: {dependency}',
|
||||||
Pip.install if not self._is_virtual else self._wait, dependency if not self._is_virtual else 2,
|
Pip.install if not self._is_virtual else self._wait, dependency if not self._is_virtual else 2,
|
||||||
source=self._cli_settings.pip_path if 'cpl-' in dependency else None,
|
'--upgrade',
|
||||||
|
source=self._cli_settings.pip_path,
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
text_foreground_color=ForegroundColorEnum.green,
|
text_foreground_color=ForegroundColorEnum.green,
|
||||||
spinner_foreground_color=ForegroundColorEnum.cyan
|
spinner_foreground_color=ForegroundColorEnum.cyan
|
||||||
)
|
)
|
||||||
|
local_package = Pip.get_package(dependency)
|
||||||
|
if local_package is None:
|
||||||
|
Error.warn(f'Installation of package {dependency} failed!')
|
||||||
|
return
|
||||||
|
|
||||||
if not self._is_virtual:
|
if not self._is_virtual:
|
||||||
Pip.reset_executable()
|
Pip.reset_executable()
|
||||||
@ -154,7 +164,7 @@ class InstallService(CommandABC):
|
|||||||
Console.spinner(
|
Console.spinner(
|
||||||
f'Installing: {package}' if not self._is_dev else f'Installing dev: {package}',
|
f'Installing: {package}' if not self._is_dev else f'Installing dev: {package}',
|
||||||
Pip.install if not self._is_virtual else self._wait, package if not self._is_virtual else 2,
|
Pip.install if not self._is_virtual else self._wait, package if not self._is_virtual else 2,
|
||||||
source=self._cli_settings.pip_path if 'cpl-' in package or 'cpl_' in package else None,
|
source=self._cli_settings.pip_path,
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
text_foreground_color=ForegroundColorEnum.green,
|
text_foreground_color=ForegroundColorEnum.green,
|
||||||
@ -221,6 +231,18 @@ class InstallService(CommandABC):
|
|||||||
args.remove('simulate')
|
args.remove('simulate')
|
||||||
Console.write_line('Running in simulation mode:')
|
Console.write_line('Running in simulation mode:')
|
||||||
|
|
||||||
|
if 'cpl-prod' in args:
|
||||||
|
args.remove('cpl-prod')
|
||||||
|
self._cli_settings.from_dict({'PipPath': 'https://pip.sh-edraft.de'})
|
||||||
|
|
||||||
|
if 'cpl-exp' in args:
|
||||||
|
args.remove('cpl-exp')
|
||||||
|
self._cli_settings.from_dict({'PipPath': 'https://pip-exp.sh-edraft.de'})
|
||||||
|
|
||||||
|
if 'cpl-dev' in args:
|
||||||
|
args.remove('cpl-dev')
|
||||||
|
self._cli_settings.from_dict({'PipPath': 'https://pip-dev.sh-edraft.de'})
|
||||||
|
|
||||||
VenvHelper.init_venv(self._is_virtual, self._env, self._project_settings)
|
VenvHelper.init_venv(self._is_virtual, self._env, self._project_settings)
|
||||||
|
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
|
@ -76,7 +76,7 @@ class UpdateService(CommandABC):
|
|||||||
'--upgrade',
|
'--upgrade',
|
||||||
'--upgrade-strategy',
|
'--upgrade-strategy',
|
||||||
'eager',
|
'eager',
|
||||||
source=self._cli_settings.pip_path if 'cpl-' in name else None,
|
source=self._cli_settings.pip_path,
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL
|
stderr=subprocess.DEVNULL
|
||||||
)
|
)
|
||||||
@ -169,6 +169,18 @@ class UpdateService(CommandABC):
|
|||||||
Console.write_line('Running in simulation mode:')
|
Console.write_line('Running in simulation mode:')
|
||||||
self._is_simulation = True
|
self._is_simulation = True
|
||||||
|
|
||||||
|
if 'cpl-prod' in args:
|
||||||
|
args.remove('cpl-prod')
|
||||||
|
self._cli_settings.from_dict({'PipPath': 'https://pip.sh-edraft.de'})
|
||||||
|
|
||||||
|
if 'cpl-exp' in args:
|
||||||
|
args.remove('cpl-exp')
|
||||||
|
self._cli_settings.from_dict({'PipPath': 'https://pip-exp.sh-edraft.de'})
|
||||||
|
|
||||||
|
if 'cpl-dev' in args:
|
||||||
|
args.remove('cpl-dev')
|
||||||
|
self._cli_settings.from_dict({'PipPath': 'https://pip-dev.sh-edraft.de'})
|
||||||
|
|
||||||
VenvHelper.init_venv(False, self._env, self._project_settings)
|
VenvHelper.init_venv(False, self._env, self._project_settings)
|
||||||
|
|
||||||
self._check_project_dependencies()
|
self._check_project_dependencies()
|
||||||
|
@ -42,7 +42,10 @@ class StartupArgumentExtension(StartupExtensionABC):
|
|||||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'install', ['i', 'I'], InstallService, True, validators=[ProjectValidator]) \
|
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'install', ['i', 'I'], InstallService, True, validators=[ProjectValidator]) \
|
||||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'dev', ['d', 'D']) \
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'dev', ['d', 'D']) \
|
||||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
|
||||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-prod', ['cp', 'CP']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-exp', ['ce', 'CE']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-dev', ['cd', 'CD'])
|
||||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'new', ['n', 'N'], NewService, True) \
|
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'new', ['n', 'N'], NewService, True) \
|
||||||
.add_console_argument(ArgumentTypeEnum.Variable, '', 'console', ['c', 'C'], ' ') \
|
.add_console_argument(ArgumentTypeEnum.Variable, '', 'console', ['c', 'C'], ' ') \
|
||||||
.add_console_argument(ArgumentTypeEnum.Variable, '', 'library', ['l', 'L'], ' ') \
|
.add_console_argument(ArgumentTypeEnum.Variable, '', 'library', ['l', 'L'], ' ') \
|
||||||
@ -63,7 +66,10 @@ class StartupArgumentExtension(StartupExtensionABC):
|
|||||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'virtual', ['v', 'V']) \
|
||||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
|
||||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'update', ['u', 'U'], UpdateService, True, validators=[ProjectValidator]) \
|
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'update', ['u', 'U'], UpdateService, True, validators=[ProjectValidator]) \
|
||||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-prod', ['cp', 'CP']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-exp', ['ce', 'CE']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'cpl-dev', ['cd', 'CD'])
|
||||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'version', ['v', 'V'], VersionService, True)
|
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'version', ['v', 'V'], VersionService, True)
|
||||||
|
|
||||||
config.for_each_argument(lambda a: a.add_console_argument(ArgumentTypeEnum.Flag, '--', 'help', ['h', 'H']))
|
config.for_each_argument(lambda a: a.add_console_argument(ArgumentTypeEnum.Flag, '--', 'help', ['h', 'H']))
|
||||||
|
@ -65,7 +65,7 @@ class Pip:
|
|||||||
"""
|
"""
|
||||||
result = None
|
result = None
|
||||||
with suppress(Exception):
|
with suppress(Exception):
|
||||||
args = [cls._executable, "-m", "pip", "show", package]
|
args = [cls._executable, "-m", "pip", "freeze"]
|
||||||
|
|
||||||
result = subprocess.check_output(
|
result = subprocess.check_output(
|
||||||
args,
|
args,
|
||||||
@ -75,17 +75,11 @@ class Pip:
|
|||||||
if result is None:
|
if result is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
new_package: list[str] = str(result, 'utf-8').lower().split('\n')
|
for p in str(result.decode()).split('\n'):
|
||||||
new_version = ''
|
if p == package:
|
||||||
|
return p
|
||||||
|
|
||||||
for atr in new_package:
|
return None
|
||||||
if 'version' in atr:
|
|
||||||
new_version = atr.split(': ')[1]
|
|
||||||
|
|
||||||
if new_version != '':
|
|
||||||
return f'{package}=={new_version}'
|
|
||||||
|
|
||||||
return package
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_outdated(cls) -> bytes:
|
def get_outdated(cls) -> bytes:
|
||||||
|
@ -16,9 +16,13 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl_core==2022.6.1"
|
"cpl-core==2022.10rc2",
|
||||||
|
"cpl-translation==2022.7.0.post2",
|
||||||
|
"cpl-query==2022.7.0"
|
||||||
|
],
|
||||||
|
"DevDependencies": [
|
||||||
|
"cpl-cli==2022.10.rc2"
|
||||||
],
|
],
|
||||||
"DevDependencies": [],
|
|
||||||
"PythonVersion": ">=3.10",
|
"PythonVersion": ">=3.10",
|
||||||
"PythonPath": {
|
"PythonPath": {
|
||||||
"linux": "../../venv/bin/python",
|
"linux": "../../venv/bin/python",
|
||||||
|
Loading…
Reference in New Issue
Block a user