2021.4.1 #11
2
cpl.json
2
cpl.json
@ -29,7 +29,7 @@
|
|||||||
"watchdog==2.0.2"
|
"watchdog==2.0.2"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.8",
|
"PythonVersion": ">=3.8",
|
||||||
"PythonPath": "",
|
"PythonPath": {},
|
||||||
"Classifiers": []
|
"Classifiers": []
|
||||||
},
|
},
|
||||||
"BuildSettings": {
|
"BuildSettings": {
|
||||||
|
@ -48,7 +48,7 @@ class InstallService(CommandABC):
|
|||||||
Error.error('Found invalid dependencies in cpl.json.')
|
Error.error('Found invalid dependencies in cpl.json.')
|
||||||
return
|
return
|
||||||
|
|
||||||
Pip.set_executable(self._project_settings.python_path)
|
Pip.set_executable(self._project_settings.python_executable)
|
||||||
for dependency in self._project_settings.dependencies:
|
for dependency in self._project_settings.dependencies:
|
||||||
Console.spinner(
|
Console.spinner(
|
||||||
f'Installing: {dependency}',
|
f'Installing: {dependency}',
|
||||||
@ -69,7 +69,7 @@ class InstallService(CommandABC):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
is_already_in_project = False
|
is_already_in_project = False
|
||||||
Pip.set_executable(self._project_settings.python_path)
|
Pip.set_executable(self._project_settings.python_executable)
|
||||||
|
|
||||||
if self._project_settings is None or self._build_settings is None:
|
if self._project_settings is None or self._build_settings 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.')
|
||||||
|
@ -87,6 +87,9 @@ class NewService(CommandABC):
|
|||||||
f'sh_cpl=={version.parse(cpl.__version__)}'
|
f'sh_cpl=={version.parse(cpl.__version__)}'
|
||||||
],
|
],
|
||||||
ProjectSettingsNameEnum.python_version.value: f'>={sys.version.split(" ")[0]}',
|
ProjectSettingsNameEnum.python_version.value: f'>={sys.version.split(" ")[0]}',
|
||||||
|
ProjectSettingsNameEnum.python_path.value: {
|
||||||
|
sys.platform: ''
|
||||||
|
},
|
||||||
ProjectSettingsNameEnum.classifiers.value: []
|
ProjectSettingsNameEnum.classifiers.value: []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ 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)
|
Pip.set_executable(self._project_settings.python_executable)
|
||||||
|
|
||||||
package = args[0]
|
package = args[0]
|
||||||
is_in_dependencies = False
|
is_in_dependencies = False
|
||||||
|
@ -127,7 +127,7 @@ class UpdateService(CommandABC):
|
|||||||
:param args:
|
:param args:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
Pip.set_executable(self._project_settings.python_path)
|
Pip.set_executable(self._project_settings.python_executable)
|
||||||
self._check_project_dependencies()
|
self._check_project_dependencies()
|
||||||
self._check_outdated()
|
self._check_outdated()
|
||||||
Pip.reset_executable()
|
Pip.reset_executable()
|
||||||
|
@ -30,6 +30,7 @@ class ProjectSettings(ConfigurationModelABC):
|
|||||||
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._python_path: Optional[str] = None
|
||||||
|
self._python_executable: Optional[str] = None
|
||||||
self._classifiers: Optional[list[str]] = None
|
self._classifiers: Optional[list[str]] = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -88,6 +89,10 @@ class ProjectSettings(ConfigurationModelABC):
|
|||||||
def python_path(self) -> str:
|
def python_path(self) -> str:
|
||||||
return self._python_path
|
return self._python_path
|
||||||
|
|
||||||
|
@property
|
||||||
|
def python_executable(self) -> str:
|
||||||
|
return self._python_executable
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def classifiers(self) -> list[str]:
|
def classifiers(self) -> list[str]:
|
||||||
return self._classifiers
|
return self._classifiers
|
||||||
@ -107,9 +112,11 @@ 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]
|
||||||
|
self._python_path = settings[ProjectSettingsNameEnum.python_path.value]
|
||||||
|
|
||||||
if ProjectSettingsNameEnum.python_path.value in settings:
|
if ProjectSettingsNameEnum.python_path.value in settings and \
|
||||||
path = settings[ProjectSettingsNameEnum.python_path.value]
|
sys.platform in settings[ProjectSettingsNameEnum.python_path.value]:
|
||||||
|
path = settings[ProjectSettingsNameEnum.python_path.value][sys.platform]
|
||||||
if not os.path.isfile(path) and not os.path.islink(path):
|
if not os.path.isfile(path) and not os.path.islink(path):
|
||||||
if path != '' and path is not None:
|
if path != '' and path is not None:
|
||||||
Error.warn(f'{ProjectSettingsNameEnum.python_path.value} not found')
|
Error.warn(f'{ProjectSettingsNameEnum.python_path.value} not found')
|
||||||
@ -118,7 +125,7 @@ class ProjectSettings(ConfigurationModelABC):
|
|||||||
else:
|
else:
|
||||||
path = sys.executable
|
path = sys.executable
|
||||||
|
|
||||||
self._python_path = path
|
self._python_executable = path
|
||||||
|
|
||||||
self._classifiers = settings[ProjectSettingsNameEnum.classifiers.value]
|
self._classifiers = settings[ProjectSettingsNameEnum.classifiers.value]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
"discord.py==1.6.0"
|
"discord.py==1.6.0"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.8",
|
"PythonVersion": ">=3.8",
|
||||||
"PythonPath": "../../../../cpl-env/bin/python3.9",
|
"PythonPath": {
|
||||||
|
"linux": "../../../../cpl-env/bin/python3.9"
|
||||||
|
},
|
||||||
"Classifiers": []
|
"Classifiers": []
|
||||||
},
|
},
|
||||||
"BuildSettings": {
|
"BuildSettings": {
|
||||||
|
Loading…
Reference in New Issue
Block a user