diff --git a/.travis.yml b/.travis.yml index 89999e04..855b565c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ jobs: - PYTHON=C:\\Python36\\python - &linux_s390x_36 - name: Linux | s390x | Python 365 + name: Linux | s390x | Python 3.6 language: python python: 3.6 services: docker diff --git a/cibuildwheel/bashlex_eval.py b/cibuildwheel/bashlex_eval.py index 3101089d..0128cfc7 100644 --- a/cibuildwheel/bashlex_eval.py +++ b/cibuildwheel/bashlex_eval.py @@ -1,7 +1,7 @@ import shlex import subprocess -from typing import Dict, List, NamedTuple, Optional +from typing import Dict, NamedTuple import bashlex # type: ignore @@ -45,7 +45,7 @@ def evaluate_word_node(node: bashlex.ast.node, context: NodeExecutionContext) -> word_start = node.pos[0] word_end = node.pos[1] word_string = context.input[word_start:word_end] - letters: List[Optional[str]] = list(word_string) + letters = list(word_string) for part in node.parts: part_start = part.pos[0] - word_start @@ -53,12 +53,12 @@ def evaluate_word_node(node: bashlex.ast.node, context: NodeExecutionContext) -> # Set all the characters in the part to None for i in range(part_start, part_end): - letters[i] = None + letters[i] = '' letters[part_start] = evaluate_node(part, context=context) # remove the None letters and concat - value = ''.join(l for l in letters if l is not None) + value = ''.join(letters) # apply bash-like quotes/whitespace treatment return ' '.join(word.strip() for word in shlex.split(value)) diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py index c466af3f..ecb596b1 100644 --- a/cibuildwheel/util.py +++ b/cibuildwheel/util.py @@ -3,7 +3,7 @@ import urllib.request from fnmatch import fnmatch from time import sleep -from typing import Dict, List, NamedTuple, Optional, Type, TypeVar +from typing import Dict, List, NamedTuple, Optional from .environment import ParsedEnvironment @@ -82,17 +82,14 @@ def download(url: str, dest: str) -> None: response.close() -DependencyConstraints_T = TypeVar('DependencyConstraints_T', bound='DependencyConstraints') - - class DependencyConstraints: def __init__(self, base_file_path: str): assert os.path.exists(base_file_path) self.base_file_path = os.path.abspath(base_file_path) - @classmethod - def with_defaults(cls: Type[DependencyConstraints_T]) -> DependencyConstraints_T: - return cls( + @staticmethod + def with_defaults() -> 'DependencyConstraints': + return DependencyConstraints( base_file_path=os.path.join(os.path.dirname(__file__), 'resources', 'constraints.txt') ) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 4e99094b..89d01a6e 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -82,9 +82,8 @@ def install_cpython(version: str, arch: str, nuget: str) -> str: return installation_path -def install_pypy(version: str, arch: str, url: Optional[str]) -> str: +def install_pypy(version: str, arch: str, url: str) -> str: assert arch == '32' - assert url is not None # Inside the PyPy zip file is a directory with the same name zip_filename = url.rsplit('/', 1)[-1] installation_path = os.path.join('C:\\cibw', os.path.splitext(zip_filename)[0]) @@ -106,6 +105,7 @@ def setup_python(python_configuration: PythonConfiguration, dependency_constrain if python_configuration.identifier.startswith('cp'): installation_path = install_cpython(python_configuration.version, python_configuration.arch, nuget) elif python_configuration.identifier.startswith('pp'): + assert python_configuration.url is not None installation_path = install_pypy(python_configuration.version, python_configuration.arch, python_configuration.url) else: raise ValueError("Unknown Python implementation")