Skip to content

Commit

Permalink
Update various CI tooling to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
wbond committed Aug 17, 2023
1 parent 73deb78 commit 9618d1b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 7 deletions.
9 changes: 7 additions & 2 deletions dev/_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,15 @@ def _preload(require_oscrypto, print_info):
)
)
if require_oscrypto:
backend = oscrypto.backend()
if backend == 'openssl':
from oscrypto._openssl._libcrypto import libcrypto_version
backend = '%s (%s)' % (backend, libcrypto_version)

print(
'oscrypto: %s backend, %s, %s' % (
oscrypto.backend(),
'oscrypto: %s, %s backend, %s' % (
oscrypto.__version__,
backend,
os.path.dirname(oscrypto.__file__)
)
)
5 changes: 3 additions & 2 deletions dev/_pep425.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,13 @@ def _pep425tags():
if sys.platform == 'win32':
if 'amd64' in sys.version.lower():
arches = ['win_amd64']
arches = [sys.platform]
else:
arches = [sys.platform]
elif hasattr(os, 'uname'):
(plat, _, _, _, machine) = os.uname()
plat = plat.lower().replace('/', '')
machine.replace(' ', '_').replace('/', '_')
if plat == 'linux' and sys.maxsize == 2147483647:
if plat == 'linux' and sys.maxsize == 2147483647 and 'arm' not in machine:
machine = 'i686'
arch = '%s_%s' % (plat, machine)
if _pep425_supports_manylinux():
Expand Down
28 changes: 28 additions & 0 deletions dev/ci-cleanup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function

import os
import shutil

from . import build_root, other_packages


def run():
"""
Cleans up CI dependencies - used for persistent GitHub Actions
Runners since they don't clean themselves up.
"""

print("Removing ci dependencies")
deps_dir = os.path.join(build_root, 'modularcrypto-deps')
if os.path.exists(deps_dir):
shutil.rmtree(deps_dir, ignore_errors=True)

print("Removing modularcrypto packages")
for other_package in other_packages:
pkg_dir = os.path.join(build_root, other_package)
if os.path.exists(pkg_dir):
shutil.rmtree(pkg_dir, ignore_errors=True)
print()

return True
6 changes: 6 additions & 0 deletions dev/ci-driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ def run(**_):
else:
_write_env(env, 'OSCRYPTO_USE_OPENSSL', '/usr/lib/libcrypto.35.dylib,/usr/lib/libssl.35.dylib')
newline = True
if 'openssl3' in options and sys.platform == 'darwin':
_write_env(
env,
'OSCRYPTO_USE_OPENSSL',
'/usr/local/opt/openssl@3/lib/libcrypto.dylib,/usr/local/opt/openssl@3/lib/libssl.dylib'
)
if 'winlegacy' in options:
_write_env(env, 'OSCRYPTO_USE_WINLEGACY', 'true')
newline = True
Expand Down
2 changes: 2 additions & 0 deletions dev/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
deps_dir = os.path.join(build_root, 'modularcrypto-deps')
if os.path.exists(deps_dir):
site.addsitedir(deps_dir)
# In case any of the deps are installed system-wide
sys.path.insert(0, deps_dir)

if sys.version_info[0:2] not in [(2, 6), (3, 2)]:
from .lint import run as run_lint
Expand Down
16 changes: 13 additions & 3 deletions dev/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def _extract_package(deps_dir, pkg_path, pkg_dir):
zf.close()
return

# Source archives may contain a bunch of other things, including mutliple
# Source archives may contain a bunch of other things, including multiple
# packages, so we must use setup.py/setuptool to install/extract it

ar = None
Expand Down Expand Up @@ -541,7 +541,7 @@ def _stage_requirements(deps_dir, path):
Python do not support that
:param deps_dir:
A unicode path to a temporary diretory to use for downloads
A unicode path to a temporary directory to use for downloads
:param path:
A unicode filesystem path to a requirements file
Expand Down Expand Up @@ -638,7 +638,17 @@ def _parse_requires(path):
package = package.strip()
cond = cond.strip()
cond = cond.replace('sys_platform', repr(sys_platform))
cond = cond.replace('python_version', repr(python_version))
cond = re.sub(
r'[\'"]'
r'(\d+(?:\.\d+)*)'
r'([-._]?(?:alpha|a|beta|b|preview|pre|c|rc)\.?\d*)?'
r'(-\d+|(?:[-._]?(?:rev|r|post)\.?\d*))?'
r'([-._]?dev\.?\d*)?'
r'[\'"]',
r'_tuple_from_ver(\g<0>)',
cond
)
cond = cond.replace('python_version', '_tuple_from_ver(%r)' % python_version)
if not eval(cond):
continue
else:
Expand Down

0 comments on commit 9618d1b

Please sign in to comment.