From 891e3c62280e82ef86361bbb0358f614961cb387 Mon Sep 17 00:00:00 2001 From: GChristensen Date: Sun, 13 Oct 2019 20:46:59 +0400 Subject: [PATCH] finished Python 3.8 migration --- changelog.md | 5 ++++ enso/debug.bat | 2 +- enso/enso/config.py | 12 +++++++-- enso/enso/contrib/retreat.py | 6 ++--- enso/enso/contrib/scriptotron/tracker.py | 6 ++--- .../platform/win32/shortcuts/Shortcuts.py | 2 +- enso/enso/webui.py | 2 +- enso/enso/webui/tutorial.html | 23 ++++++++-------- enso/scripts/run_enso.py | 27 +++++++++++++------ platform/win32/Graphics/cairo/SConscript | 10 ------- readme.md | 6 +++-- 11 files changed, 59 insertions(+), 42 deletions(-) diff --git a/changelog.md b/changelog.md index ba9f116a..0226bf02 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +##### xx.10.2019 (v.0.5.0) +* Migrated to Python 3.8 +* Updated Cairo graphics library to the recent version (1.16.0) +* Dropped support of "~/.ensocommands" file + ##### 11.10.2019 (v.0.4.6) * Fixed command editor undo history. diff --git a/enso/debug.bat b/enso/debug.bat index e82b44ac..9dff9911 100644 --- a/enso/debug.bat +++ b/enso/debug.bat @@ -1,3 +1,3 @@ set PYTHONPATH=%~dp0 -.\python\python .\scripts\run_enso.py -l INFO \ No newline at end of file +.\python\python .\scripts\run_enso.py %* \ No newline at end of file diff --git a/enso/enso/config.py b/enso/enso/config.py index aaf4209f..935f473b 100644 --- a/enso/enso/config.py +++ b/enso/enso/config.py @@ -3,7 +3,7 @@ # such strings). # Enso version for use in UI -ENSO_VERSION = "0.4.6" +ENSO_VERSION = "0.5.0" # Web UI can be disabled as a security option ENABLE_WEB_UI = True @@ -125,7 +125,15 @@ from ast import literal_eval ENSO_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -ENSO_USER_DIR = os.path.expanduser(os.path.join("~", ".enso")) + +ENSO_USER_DIR = None + +HOME_DIR = os.getenv("HOME") +if HOME_DIR: + ENSO_USER_DIR = os.path.join(HOME_DIR, ".enso") + +if not ENSO_USER_DIR: + ENSO_USER_DIR = os.path.expanduser(os.path.join("~", ".enso")) ENSO_EXECUTABLE = os.path.join(ENSO_DIR, "run-enso.exe") if not os.path.exists(ENSO_EXECUTABLE): diff --git a/enso/enso/contrib/retreat.py b/enso/enso/contrib/retreat.py index 05efa764..7ea08649 100644 --- a/enso/enso/contrib/retreat.py +++ b/enso/enso/contrib/retreat.py @@ -3,9 +3,9 @@ def installed(): - # retereat_spec = importlib.util.find_spec('enso.contrib._retreat') - # if retereat_spec is not None: - # return True + retereat_spec = importlib.util.find_spec('enso.contrib._retreat') + if retereat_spec is not None: + return True return False diff --git a/enso/enso/contrib/scriptotron/tracker.py b/enso/enso/contrib/scriptotron/tracker.py index 349ae0de..c24dd674 100644 --- a/enso/enso/contrib/scriptotron/tracker.py +++ b/enso/enso/contrib/scriptotron/tracker.py @@ -67,7 +67,7 @@ class ScriptTracker: def __init__( self, eventManager, commandManager ): self._scriptCmdTracker = ScriptCommandTracker( commandManager, eventManager ) - self._scriptFilename = os.path.expanduser(SCRIPTS_FILE_NAME) + #self._scriptFilename = os.path.expanduser(SCRIPTS_FILE_NAME) from enso.providers import getInterface self._scriptFolder = getInterface("scripts_folder")() self._lastMods = {} @@ -131,7 +131,7 @@ def _getCommandFiles( self ): def _reloadPyScripts( self ): self._scriptCmdTracker.clearCommands() - commandFiles = [self._scriptFilename] + self._getCommandFiles() + commandFiles = self._getCommandFiles() print(commandFiles) for f in commandFiles: try: @@ -161,7 +161,7 @@ def _reloadPyScripts( self ): self._registerDependencies( allGlobals ) def _registerDependencies( self, allGlobals = None ): - baseDeps = [ self._scriptFilename ] + self._getCommandFiles() + baseDeps = self._getCommandFiles() if allGlobals: # Find any other files that the script may have executed diff --git a/enso/enso/platform/win32/shortcuts/Shortcuts.py b/enso/enso/platform/win32/shortcuts/Shortcuts.py index e756529b..591542fb 100644 --- a/enso/enso/platform/win32/shortcuts/Shortcuts.py +++ b/enso/enso/platform/win32/shortcuts/Shortcuts.py @@ -12,7 +12,7 @@ my_documents_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, 0, 0) -LEARN_AS_DIR = os.path.join(os.path.expanduser("~"), ".enso", "commands", "learned") +LEARN_AS_DIR = os.path.join(config.ENSO_USER_DIR, "commands", "learned") # Check if Learn-as dir exist and create it if not if (not os.path.isdir(LEARN_AS_DIR)): diff --git a/enso/enso/webui.py b/enso/enso/webui.py index 43bfef05..3c2152f9 100644 --- a/enso/enso/webui.py +++ b/enso/enso/webui.py @@ -66,7 +66,7 @@ def get_enso_set_config(key, value): @app.route('/api/enso/get/config_dir') def get_enso_get_config_dir(): - return os.path.expanduser(config.ENSO_USER_DIR) + return config.ENSO_USER_DIR @app.route('/api/enso/open/config_dir') def get_enso_open_config_dir(): diff --git a/enso/enso/webui/tutorial.html b/enso/enso/webui/tutorial.html index 2993917a..adce1a59 100644 --- a/enso/enso/webui/tutorial.html +++ b/enso/enso/webui/tutorial.html @@ -60,9 +60,9 @@

settings page allows to specify any Python code needed to initialize Enso. By using it, you may override variables from config.py or provide values required by some commands. You can access variables declared at this block in your own commands through - the 'config' module. For example, you can obtain the following variable: + the 'config' module. For example, you can obtain MY_VARIABLE defined at the configuration block:

MY_VARIABLE = "my value"

-

with the following code in your command:

+

in the following way at your command code:

from enso import config
my_value = config.MY_VARIABLE

Creating Enso Commands

@@ -208,14 +208,15 @@

Including Other Files

-

Python's standard import statement can be used from command - scripts, of course. But the disadvantage of doing this with evolving - code is that imported modules won't be reloaded - if their contents change.
- It is possible to install or uninstall Python libraries from PyPi +

It is possible to install or uninstall Python libraries from PyPi using 'enso install' and 'enso uninstall' commands respectively.
If you need to import some code that is not installable as a Python module, - place it under the 'lib' folder at your Enso configuration directory (available at the Enso settings page).

+ place it under the 'lib' folder at your Enso configuration directory (available at the Enso settings page). +
+ Python's standard import statement can be used from command + scripts. But the disadvantage of doing this with evolving + code is that imported modules won't be reloaded + if their contents change.

Mediaprobes

Mediaprobes allow to create commands that automatically pass items found in filesystem (or listed @@ -235,12 +236,12 @@