Added majority of type annotations (to a by now outdated version)
This commit is contained in:
+15
-8
@@ -7,16 +7,21 @@ import tempfile
|
||||
from collections import namedtuple
|
||||
from glob import glob
|
||||
|
||||
from typing import Callable, Dict, List, Optional, Union
|
||||
|
||||
from .environment import (
|
||||
ParsedEnvironment,
|
||||
)
|
||||
from .util import (
|
||||
BuildOptions,
|
||||
download,
|
||||
get_build_verbosity_extra_flags,
|
||||
prepare_command,
|
||||
get_pip_script,
|
||||
BuildOptions
|
||||
prepare_command,
|
||||
)
|
||||
|
||||
|
||||
def call(args, env=None, cwd=None, shell=False):
|
||||
def call(args: Union[str, List[str]], env: Optional[Dict[str, str]] = None, cwd: Optional[str] = None, shell: bool = False) -> int:
|
||||
# print the command executing for the logs
|
||||
if shell:
|
||||
print('+ %s' % args)
|
||||
@@ -26,8 +31,10 @@ def call(args, env=None, cwd=None, shell=False):
|
||||
return subprocess.check_call(args, env=env, cwd=cwd, shell=shell)
|
||||
|
||||
|
||||
def get_python_configurations(build_selector):
|
||||
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url'])
|
||||
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url'])
|
||||
|
||||
|
||||
def get_python_configurations(build_selector: Callable[[str], bool]) -> List[PythonConfiguration]:
|
||||
python_configurations = [
|
||||
# CPython
|
||||
PythonConfiguration(version='2.7', identifier='cp27-macosx_x86_64', url='https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg'),
|
||||
@@ -47,7 +54,7 @@ def get_python_configurations(build_selector):
|
||||
SYMLINKS_DIR = '/tmp/cibw_bin'
|
||||
|
||||
|
||||
def make_symlinks(installation_bin_path, python_executable, pip_executable):
|
||||
def make_symlinks(installation_bin_path: str, python_executable: str, pip_executable: str) -> None:
|
||||
assert os.path.exists(os.path.join(installation_bin_path, python_executable))
|
||||
|
||||
# Python bin folders on Mac don't symlink `python3` to `python`, and neither
|
||||
@@ -62,7 +69,7 @@ def make_symlinks(installation_bin_path, python_executable, pip_executable):
|
||||
os.symlink(os.path.join(installation_bin_path, pip_executable), os.path.join(SYMLINKS_DIR, 'pip'))
|
||||
|
||||
|
||||
def install_cpython(version, url):
|
||||
def install_cpython(version: str, url: str) -> str:
|
||||
installed_system_packages = subprocess.check_output(['pkgutil', '--pkgs'], universal_newlines=True).splitlines()
|
||||
|
||||
# if this version of python isn't installed, get it from python.org and install
|
||||
@@ -86,7 +93,7 @@ def install_cpython(version, url):
|
||||
return installation_bin_path
|
||||
|
||||
|
||||
def install_pypy(version, url):
|
||||
def install_pypy(version: str, url: str) -> str:
|
||||
pypy_tar_bz2 = url.rsplit('/', 1)[-1]
|
||||
assert pypy_tar_bz2.endswith(".tar.bz2")
|
||||
pypy_base_filename = os.path.splitext(os.path.splitext(pypy_tar_bz2)[0])[0]
|
||||
|
||||
Reference in New Issue
Block a user