This commit is contained in:
Sven Heidemann 2021-03-14 12:05:57 +01:00
parent 02b4f78baf
commit 072f58a2e9
6 changed files with 18 additions and 5 deletions

View File

@ -26,7 +26,8 @@
"termcolor==1.1.0", "termcolor==1.1.0",
"watchdog==2.0.2" "watchdog==2.0.2"
], ],
"PythonVersion": ">=3.8" "PythonVersion": ">=3.8",
"Classifiers": []
}, },
"BuildSettings": { "BuildSettings": {
"SourcePath": "src", "SourcePath": "src",

View File

@ -66,7 +66,8 @@ class NewService(CommandABC):
ProjectSettingsNameEnum.dependencies.value: [ ProjectSettingsNameEnum.dependencies.value: [
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.classifiers.value: []
} }
self._project.from_dict(self._project_dict) self._project.from_dict(self._project_dict)

View File

@ -26,6 +26,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._classifiers: Optional[list[str]] = None
@property @property
def name(self): def name(self):
@ -79,6 +80,10 @@ class ProjectSettings(ConfigurationModelABC):
def python_version(self) -> str: def python_version(self) -> str:
return self._python_version return self._python_version
@property
def classifiers(self) -> list[str]:
return self._classifiers
def from_dict(self, settings: dict): def from_dict(self, settings: dict):
try: try:
self._name = settings[ProjectSettingsNameEnum.name.value] self._name = settings[ProjectSettingsNameEnum.name.value]
@ -94,6 +99,7 @@ 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._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)
Console.write_line( Console.write_line(

View File

@ -2,7 +2,6 @@ from enum import Enum
class ProjectSettingsNameEnum(Enum): class ProjectSettingsNameEnum(Enum):
name = 'Name' name = 'Name'
version = 'Version' version = 'Version'
author = 'Author' author = 'Author'
@ -16,3 +15,4 @@ class ProjectSettingsNameEnum(Enum):
license_description = 'LicenseDescription' license_description = 'LicenseDescription'
dependencies = 'Dependencies' dependencies = 'Dependencies'
python_version = 'PythonVersion' python_version = 'PythonVersion'
classifiers = 'Classifiers'

View File

@ -103,15 +103,19 @@ class PublisherService(PublisherABC):
relative_path = os.path.relpath(r) relative_path = os.path.relpath(r)
file_path = os.path.join(relative_path, os.path.relpath(sub_file)) file_path = os.path.join(relative_path, os.path.relpath(sub_file))
print(file_path)
self._included_files.append(os.path.relpath(file_path)) self._included_files.append(os.path.relpath(file_path))
elif os.path.isfile(rel_path): elif os.path.isfile(rel_path):
print(rel_path)
self._included_files.append(rel_path) self._included_files.append(rel_path)
for r, d, f in os.walk(self._build_settings.source_path): for r, d, f in os.walk(self._build_settings.source_path):
for file in f: for file in f:
relative_path = os.path.relpath(r) relative_path = os.path.relpath(r)
file_path = os.path.join(relative_path, os.path.relpath(file)) file_path = os.path.join(relative_path, os.path.relpath(file))
if self._is_path_excluded(relative_path):
break
if len(d) > 0: if len(d) > 0:
for directory in d: for directory in d:
@ -243,7 +247,7 @@ class PublisherService(PublisherABC):
except Exception as e: except Exception as e:
Console.error('Could not find entry point', str(e)) Console.error('Could not find entry point', str(e))
if main is None: if main is None or not hasattr(main, 'main'):
Console.error('Could not find entry point') Console.error('Could not find entry point')
return return

View File

@ -18,7 +18,8 @@
"Dependencies": [ "Dependencies": [
"sh_cpl==2021.4.1" "sh_cpl==2021.4.1"
], ],
"PythonVersion": ">=3.8" "PythonVersion": ">=3.8",
"Classifiers": []
}, },
"BuildSettings": { "BuildSettings": {
"SourcePath": "", "SourcePath": "",