2021.4.1 #11

Merged
edraft merged 172 commits from 2021.04.01 into 2021.04 2021-03-21 20:04:24 +01:00
5 changed files with 55 additions and 28 deletions
Showing only changes of commit aa4931fd18 - Show all commits

View File

@ -22,10 +22,12 @@
<select /> <select />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Improved application host"> <list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Added cpl.json">
<change afterPath="$PROJECT_DIR$/src/cpl.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/cpl.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/cpl.json" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/cpl/application/application_host.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_host.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/application/application_runtime.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_runtime.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/application/application_runtime_abc.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_runtime_abc.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/startup.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/startup.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -97,7 +99,7 @@
<recent name="$PROJECT_DIR$/src/cpl/database" /> <recent name="$PROJECT_DIR$/src/cpl/database" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Python.main cli"> <component name="RunManager" selected="Python.cli help">
<configuration name="cli build" type="PythonConfigurationType" factoryName="Python"> <configuration name="cli build" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" /> <module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
@ -486,13 +488,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1605881914521</updated> <updated>1605881914521</updated>
</task> </task>
<task id="LOCAL-00042" summary="Published for 2020.12.9">
<created>1608049772153</created>
<option name="number" value="00042" />
<option name="presentableId" value="LOCAL-00042" />
<option name="project" value="LOCAL" />
<updated>1608049772153</updated>
</task>
<task id="LOCAL-00043" summary="Publish improvements for pip install"> <task id="LOCAL-00043" summary="Publish improvements for pip install">
<created>1608059323858</created> <created>1608059323858</created>
<option name="number" value="00043" /> <option name="number" value="00043" />
@ -829,7 +824,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1614837218919</updated> <updated>1614837218919</updated>
</task> </task>
<option name="localTasksCounter" value="91" /> <task id="LOCAL-00091" summary="Added cpl.json">
<created>1614837337289</created>
<option name="number" value="00091" />
<option name="presentableId" value="LOCAL-00091" />
<option name="project" value="LOCAL" />
<updated>1614837337289</updated>
</task>
<option name="localTasksCounter" value="92" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -845,8 +847,6 @@
<option name="oldMeFiltersMigrated" value="true" /> <option name="oldMeFiltersMigrated" value="true" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="Published" />
<MESSAGE value="Improved publisher" />
<MESSAGE value="Added imports" /> <MESSAGE value="Added imports" />
<MESSAGE value="Removed build form gitignore, added build command" /> <MESSAGE value="Removed build form gitignore, added build command" />
<MESSAGE value="Added init file for build command package" /> <MESSAGE value="Added init file for build command package" />
@ -870,7 +870,9 @@
<MESSAGE value="Improved cli" /> <MESSAGE value="Improved cli" />
<MESSAGE value="Smaller bugfixes" /> <MESSAGE value="Smaller bugfixes" />
<MESSAGE value="Improved application host" /> <MESSAGE value="Improved application host" />
<option name="LAST_COMMIT_MESSAGE" value="Improved application host" /> <MESSAGE value="Improved cpl.json" />
<MESSAGE value="Added cpl.json" />
<option name="LAST_COMMIT_MESSAGE" value="Added cpl.json" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -1,6 +1,5 @@
import atexit import atexit
from collections import Callable from collections import Callable
from datetime import datetime
from cpl.application.application_host_abc import ApplicationHostABC from cpl.application.application_host_abc import ApplicationHostABC
from cpl.application.application_runtime import ApplicationRuntime from cpl.application.application_runtime import ApplicationRuntime
@ -22,10 +21,6 @@ class ApplicationHost(ApplicationHostABC):
self._app_runtime = ApplicationRuntime(self._config) self._app_runtime = ApplicationRuntime(self._config)
self._services = ServiceProvider(self._app_runtime) self._services = ServiceProvider(self._app_runtime)
# Set vars
self._start_time: datetime = datetime.now()
self._end_time: datetime = datetime.now()
@property @property
def configuration(self) -> ConfigurationABC: def configuration(self) -> ConfigurationABC:
return self._config return self._config

View File

@ -1,3 +1,4 @@
import pathlib
from datetime import datetime from datetime import datetime
from cpl.application.application_runtime_abc import ApplicationRuntimeABC from cpl.application.application_runtime_abc import ApplicationRuntimeABC
@ -12,6 +13,8 @@ class ApplicationRuntime(ApplicationRuntimeABC):
self._app_configuration = config self._app_configuration = config
self._start_time: datetime = datetime.now() self._start_time: datetime = datetime.now()
self._end_time: datetime = datetime.now() self._end_time: datetime = datetime.now()
self._working_directory = pathlib.Path().absolute()
self._runtime_directory = pathlib.Path(__file__).parent.absolute()
@property @property
def configuration(self) -> ConfigurationABC: def configuration(self) -> ConfigurationABC:
@ -21,10 +24,6 @@ class ApplicationRuntime(ApplicationRuntimeABC):
def start_time(self) -> datetime: def start_time(self) -> datetime:
return self._start_time return self._start_time
@start_time.setter
def start_time(self, start_time: datetime):
self._start_time = start_time
@property @property
def end_time(self) -> datetime: def end_time(self) -> datetime:
return self._end_time return self._end_time
@ -36,3 +35,21 @@ class ApplicationRuntime(ApplicationRuntimeABC):
@property @property
def date_time_now(self) -> datetime: def date_time_now(self) -> datetime:
return datetime.now() return datetime.now()
@property
def working_directory(self) -> str:
return self._working_directory
def set_working_directory(self, path: str = ''):
if path != '':
self._working_directory = path
return
self._working_directory = pathlib.Path().absolute()
@property
def runtime_directory(self) -> str:
return self._runtime_directory
def set_runtime_directory(self, file: str):
self._runtime_directory = pathlib.Path(file).parent.absolute()

View File

@ -32,3 +32,14 @@ class ApplicationRuntimeABC(ABC):
@property @property
@abstractmethod @abstractmethod
def date_time_now(self) -> datetime: pass def date_time_now(self) -> datetime: pass
@property
@abstractmethod
def working_directory(self) -> str: pass
@property
@abstractmethod
def runtime_directory(self) -> str: pass
@abstractmethod
def set_runtime_directory(self, runtime_directory: str): pass

View File

@ -22,18 +22,20 @@ class Startup(StartupABC):
def create_application_host(self) -> ApplicationHostABC: def create_application_host(self) -> ApplicationHostABC:
self._app_host = ApplicationHost() self._app_host = ApplicationHost()
self._app_host.application_runtime.set_runtime_directory(__file__)
self._app_host.console_argument_error_function(Error.error)
self._configuration = self._app_host.configuration self._configuration = self._app_host.configuration
self._services = self._app_host.services self._services = self._app_host.services
self._app_host.console_argument_error_function(Error.error)
return self._app_host return self._app_host
def create_configuration(self) -> ConfigurationABC: def create_configuration(self) -> ConfigurationABC:
self._configuration.add_environment_variables('PYTHON_') self._configuration.add_environment_variables('PYTHON_')
self._configuration.add_environment_variables('CPL_') self._configuration.add_environment_variables('CPL_')
self._configuration.add_console_argument('', 'help', ['h'], '') self._configuration.add_console_argument('', 'help', ['-h', '-H'], '')
self._configuration.add_console_argument('', 'version', ['v'], '') self._configuration.add_console_argument('', 'version', ['-v', '-V'], '')
self._configuration.add_console_arguments() self._configuration.add_console_arguments()
return self._configuration return self._configuration