From 873ffdb61eb461b4c71ab7e12151864b49a23f3a Mon Sep 17 00:00:00 2001 From: cerenkov Date: Sun, 19 May 2024 00:58:08 +0800 Subject: [PATCH 1/5] Update setup.py: compatibility for older python versions --- setup.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index 470c99ed..ea984671 100755 --- a/setup.py +++ b/setup.py @@ -5,18 +5,21 @@ PACKAGE_NAME = 'you_get' PROJ_METADATA = '%s.json' % PROJ_NAME -import importlib.util -import importlib.machinery - -def load_source(modname, filename): - loader = importlib.machinery.SourceFileLoader(modname, filename) - spec = importlib.util.spec_from_file_location(modname, filename, loader=loader) - module = importlib.util.module_from_spec(spec) - # The module is always executed and not cached in sys.modules. - # Uncomment the following line to cache the module. - # sys.modules[module.__name__] = module - loader.exec_module(module) - return module +import sys +if (sys.version_info >= (3, 12)): + import importlib.util + import importlib.machinery + def load_source(modname, filename): + loader = importlib.machinery.SourceFileLoader(modname, filename) + spec = importlib.util.spec_from_file_location(modname, filename, loader=loader) + module = importlib.util.module_from_spec(spec) + # The module is always executed and not cached in sys.modules. + # Uncomment the following line to cache the module. + # sys.modules[module.__name__] = module + loader.exec_module(module) + return module +else: + from imp import load_source import os, json here = os.path.abspath(os.path.dirname(__file__)) From 317cc467e7f738390a9d451ad530736d0e848690 Mon Sep 17 00:00:00 2001 From: cerenkov Date: Sun, 19 May 2024 01:01:09 +0800 Subject: [PATCH 2/5] Update python-package.yml: add python-version 3.12 job --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 39793c03..51d56c91 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9, '3.10', '3.11', pypy-3.8, pypy-3.9] + python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12', pypy-3.8, pypy-3.9] steps: - uses: actions/checkout@v3 From adeaeb896775c5dd6397fdd6eb98a2750aa99717 Mon Sep 17 00:00:00 2001 From: cerenkov Date: Sun, 19 May 2024 01:03:54 +0800 Subject: [PATCH 3/5] Update you-get.json: add info Python :: 3.11 and 3.12 --- you-get.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/you-get.json b/you-get.json index bb94ba00..adf604dc 100644 --- a/you-get.json +++ b/you-get.json @@ -22,6 +22,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Internet", "Topic :: Internet :: WWW/HTTP", "Topic :: Multimedia", From b935d3ed02ea029f6c220e7123fd321e489fc7d8 Mon Sep 17 00:00:00 2001 From: cerenkov Date: Sun, 19 May 2024 02:01:31 +0800 Subject: [PATCH 4/5] Update python-package.yml: update setuptools --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 51d56c91..98b6c7de 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -25,7 +25,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 From 19a4f15d6014c66c99d48be4a024b89407fe428a Mon Sep 17 00:00:00 2001 From: cerenkov Date: Sun, 19 May 2024 12:03:54 +0800 Subject: [PATCH 5/5] Revert "Update setup.py: compatibility for older python versions" This reverts commit 873ffdb61eb461b4c71ab7e12151864b49a23f3a. Minimun python version 3.7 already assures importlib availability --- setup.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/setup.py b/setup.py index ea984671..470c99ed 100755 --- a/setup.py +++ b/setup.py @@ -5,21 +5,18 @@ PACKAGE_NAME = 'you_get' PROJ_METADATA = '%s.json' % PROJ_NAME -import sys -if (sys.version_info >= (3, 12)): - import importlib.util - import importlib.machinery - def load_source(modname, filename): - loader = importlib.machinery.SourceFileLoader(modname, filename) - spec = importlib.util.spec_from_file_location(modname, filename, loader=loader) - module = importlib.util.module_from_spec(spec) - # The module is always executed and not cached in sys.modules. - # Uncomment the following line to cache the module. - # sys.modules[module.__name__] = module - loader.exec_module(module) - return module -else: - from imp import load_source +import importlib.util +import importlib.machinery + +def load_source(modname, filename): + loader = importlib.machinery.SourceFileLoader(modname, filename) + spec = importlib.util.spec_from_file_location(modname, filename, loader=loader) + module = importlib.util.module_from_spec(spec) + # The module is always executed and not cached in sys.modules. + # Uncomment the following line to cache the module. + # sys.modules[module.__name__] = module + loader.exec_module(module) + return module import os, json here = os.path.abspath(os.path.dirname(__file__))