From ad15e2cb459488e4d9abfff435d7f3f8dd76f217 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 4 May 2023 16:29:00 +0200 Subject: [PATCH] Fix site-packages for Pythonista >= v3.4 (#480) --- .github/workflows/check-code-and-run-tests.yml | 2 +- bin/jobs.py | 2 +- lib/libdist.py | 2 +- system/shiowrapper.py | 6 +++--- system/shparsers.py | 2 +- system/shruntime.py | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check-code-and-run-tests.yml b/.github/workflows/check-code-and-run-tests.yml index e93492ff..bb1376ab 100644 --- a/.github/workflows/check-code-and-run-tests.yml +++ b/.github/workflows/check-code-and-run-tests.yml @@ -33,7 +33,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip wheel setuptools + python -m pip install --upgrade "pip<32.0" wheel setuptools pip install ".[testing]" - name: Analysing the code with flake8 run: | diff --git a/bin/jobs.py b/bin/jobs.py index 551caefa..87e2cfa8 100644 --- a/bin/jobs.py +++ b/bin/jobs.py @@ -12,7 +12,7 @@ def main(args): ap = argparse.ArgumentParser() ap.parse_args(args) - current_worker = threading.currentThread() + current_worker = threading.current_thread() _stash = globals()['_stash'] """:type : StaSh""" diff --git a/lib/libdist.py b/lib/libdist.py index d22f0062..c458be55 100644 --- a/lib/libdist.py +++ b/lib/libdist.py @@ -7,7 +7,7 @@ import six -IN_PYTHONISTA = sys.executable.find('Pythonista') >= 0 +IN_PYTHONISTA = "Pythonista" in sys.executable ON_CI = "CI" in os.environ diff --git a/system/shiowrapper.py b/system/shiowrapper.py index 7a2eee55..faff9d13 100644 --- a/system/shiowrapper.py +++ b/system/shiowrapper.py @@ -14,7 +14,7 @@ class ShStdinWrapper(object): def __getattribute__(self, item): - thread = threading.currentThread() + thread = threading.current_thread() if isinstance(thread, ShBaseThread): return getattr(thread.state.sys_stdin, item) @@ -24,7 +24,7 @@ def __getattribute__(self, item): class ShStdoutWrapper(object): def __getattribute__(self, item): - thread = threading.currentThread() + thread = threading.current_thread() if isinstance(thread, ShBaseThread): return getattr(thread.state.sys_stdout, item) @@ -34,7 +34,7 @@ def __getattribute__(self, item): class ShStderrWrapper(object): def __getattribute__(self, item): - thread = threading.currentThread() + thread = threading.current_thread() if isinstance(thread, ShBaseThread): return getattr(thread.state.sys_stderr, item) diff --git a/system/shparsers.py b/system/shparsers.py index 241500ec..33d513e3 100644 --- a/system/shparsers.py +++ b/system/shparsers.py @@ -652,7 +652,7 @@ def expandvars(self, s): es += str(os.environ.get(nextchar, '')) state = 'a' elif nextchar == '$': - es += str(threading.currentThread()._Thread__ident) + es += str(threading.current_thread()._Thread__ident) state = 'a' elif nextchar in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz': varname += nextchar diff --git a/system/shruntime.py b/system/shruntime.py index 1eca2924..b3edff2e 100644 --- a/system/shruntime.py +++ b/system/shruntime.py @@ -359,7 +359,7 @@ def fn(): current_worker.parent.state.persist_child(current_worker.state, persistent_level=persistent_level) # Get the parent thread - parent_thread = threading.currentThread() + parent_thread = threading.current_thread() # UI thread is substituted by runtime if not isinstance(parent_thread, ShBaseThread): @@ -679,7 +679,7 @@ def get_current_worker_and_state(self): :return: :rtype: (ShBaseThread, ShState) """ - current_worker = threading.currentThread() + current_worker = threading.current_thread() if isinstance(current_worker, ShBaseThread): return current_worker, current_worker.state else: # UI thread uses runtime for its state