Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SG-32061 Python3.7+ syntax #303

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions azure-pipelines-templates/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ jobs:
# Pass the values needed to authenticate with the Shotgun site and create some entities.
# Remember, on a pull request from a client or on forked repos, those variables
# will be empty!
SG_SERVER_URL: $(ci_site)
SG_SCRIPT_NAME: $(ci_site_script_name)
SG_API_KEY: $(ci_site_script_key)
SG_SERVER_URL: ${{variables.ci_site}}
SG_SCRIPT_NAME: ${{variables.ci_site_script_name}}
SG_API_KEY: ${{variables.ci_site_script_key}}
# The unit tests manipulate the user and project during the tests, which can cause collisions,
# so sandbox each build variant.
# Ideally, we would use the agent name here. The problem is that the agent name is in a build
Expand Down
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
f = open('LICENSE')
license = f.read().strip()

# For python 2.4 support
script_args = sys.argv[1:]
if (sys.version_info[0] <= 2) or (sys.version_info[0] == 2 and sys.version_info[1] <= 5):
if 'install' in script_args and '--no-compile' not in script_args:
script_args.append('--no-compile')


setup(
name='shotgun_api3',
Expand All @@ -39,4 +34,5 @@
include_package_data=True,
package_data={'': ['cacerts.txt', 'cacert.pem']},
zip_safe=False,
python_requires='>=3.7.0',
)
25 changes: 6 additions & 19 deletions shotgun_api3/lib/httplib2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from .. import six

# Define all here to keep linters happy. It should be overwritten by the code
# below, but if in the future __all__ is not defined in httplib2 this will keep
# things from breaking.
Expand All @@ -9,24 +7,13 @@
# current python version. httplib2 supports python 2/3 by forking the code rather
# than with a single cross-compatible module. Rather than modify third party code,
# we'll just import the appropriate branch here.
if six.PY3:
# Generate ssl_error_classes
import ssl as __ssl
ssl_error_classes = (__ssl.SSLError, __ssl.CertificateError)
del __ssl

# get the python3 fork of httplib2
from . import python3 as __httplib2_compat


else:
# Generate ssl_error_classes
from .python2 import SSLHandshakeError as __SSLHandshakeError # TODO: shouldn't rely on this. not public
ssl_error_classes = (__SSLHandshakeError,)
del __SSLHandshakeError
# Generate ssl_error_classes
import ssl as __ssl
ssl_error_classes = (__ssl.SSLError, __ssl.CertificateError)
del __ssl

# get the python2 fork of httplib2
from . import python2 as __httplib2_compat
# get the python3 fork of httplib2
from . import python3 as __httplib2_compat

# Import all of the httplib2 module. Note that we can't use a star import because
# we need to import *everything*, not just what exists in __all__.
Expand Down
Loading