From 1b8d0877f349ab427701430863f61d32ed00cf54 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Wed, 5 Apr 2023 14:33:17 +0000 Subject: [PATCH] retire soon-to-be EoL Python 3.7. Hello walrus operator... --- .github/workflows/build.yml | 7 ------- src/gam/__main__.py | 30 +++++++++++++++++++----------- src/requirements.txt | 3 +-- src/setup.cfg | 8 ++++---- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7da27d7a..73259420 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,11 +66,6 @@ jobs: goal: build arch: Win32 openssl_archs: VC-WIN32 - - os: ubuntu-22.04 - goal: test - python: "3.7" - jid: 8 - arch: x86_64 - os: ubuntu-22.04 goal: test python: "3.8" @@ -105,8 +100,6 @@ jobs: with: workload_identity_provider: projects/297925809119/locations/global/workloadIdentityPools/gha-pool/providers/gha-provider service_account: github-actions-testing-for-gam@gam-project-wyo-lub-ivl.iam.gserviceaccount.com - #access_token_scopes: https://www.googleapis.com/auth/iam - #token_format: access_token - name: Cache multiple paths if: matrix.goal == 'build' diff --git a/src/gam/__main__.py b/src/gam/__main__.py index a7c50fbb..853ea01f 100644 --- a/src/gam/__main__.py +++ b/src/gam/__main__.py @@ -22,25 +22,33 @@ For more information, see https://jaylee.us/gam """ import sys -from multiprocessing import freeze_support -from multiprocessing import set_start_method - -from gam import controlflow -import gam - +# Note that this file (and only this file) should remain compatible +# with older Python versions so we can return a meaningful error +# instead of a syntax error. def main(): + required_ver = (3, 8, 0) + if sys.version_info[:3] < required_ver: + err_result = ('ERROR: GAM requires Python %s.%s.%s or newer. You are ' + 'running %s.%s.%s. Please upgrade your Python version ' + 'or use one of the binary GAM downloads.\n' % + (required_ver[0], + required_ver[1], + required_ver[2], + sys.version_info[0], + sys.version_info[1], + sys.version_info[2])) + sys.stderr.write(err_result) + sys.exit(5) + from multiprocessing import freeze_support freeze_support() if sys.platform == 'darwin': # https://bugs.python.org/issue33725 in Python 3.8.0 seems # to break parallel operations with errors about extra -b # command line arguments + from multiprocessing import set_start_method set_start_method('fork') - if sys.version_info[0] < 3 or sys.version_info[1] < 7: - controlflow.system_error_exit( - 5, - f'GAM requires Python 3.7 or newer. You are running %s.%s.%s. Please upgrade your Python version or use one of the binary GAM downloads.' - % sys.version_info[:3]) + import gam sys.exit(gam.ProcessGAMCommand(sys.argv)) diff --git a/src/requirements.txt b/src/requirements.txt index a56a4122..a3ba3788 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -4,9 +4,8 @@ filelock google-api-python-client>=2.1 google-auth-httplib2 google-auth-oauthlib>=0.4.1 -google-auth>=2.3.2 +google-auth[reauth]>=2.3.2 httplib2>=0.17.0 -importlib.metadata; python_version < '3.8' passlib>=1.7.2 pathvalidate python-dateutil diff --git a/src/setup.cfg b/src/setup.cfg index 6961d762..cc30fcae 100644 --- a/src/setup.cfg +++ b/src/setup.cfg @@ -13,15 +13,15 @@ keywords = google, oauth2, gsuite, google-apps, google-admin-sdk, google-drive, classifiers = Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 License :: OSI Approved :: Apache License [options] packages = find: -python_requires = >= 3.7 +python_requires = >= 3.8 install_requires = cryptography distro; sys_platform == 'linux' @@ -33,9 +33,9 @@ install_requires = httplib2 >= 0.20.2 importlib.metadata; python_version < '3.8' passlib >= 1.7.4 - python-dateutil - yubikey-manager >= 4.0.0 pathvalidate + python-dateutil + yubikey-manager >= 5.0 [options.package_data] * = *.pem