Skip to content

Commit

Permalink
Fixing some review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickJadoul committed Apr 10, 2020
1 parent 8c537e9 commit 84ec4a3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions CI.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
This is a summary of the Python versions and platforms covered by the different CI platforms:

| | 3.6 | 3.7 | 3.8 |
|----------|------------------------------|---------------------------------------------------|------------------|
| Linux | Travis CI / CircleCI | AppVeyor / GitHub Actions | Azure Pipelines |
| | 3.6 | 3.7 | 3.8 |
|----------|------------------------------|----------------------------------------------------|------------------|
| Linux | Travis CI / CircleCI | AppVeyor / GitHub Actions | Azure Pipelines |
| macOS | CircleCI | AppVeyor / Travis CI¹ / CircleCI / GitHub Actions | Azure Pipelines |
| Windows | Travis CI / Azure Pipelines | AppVeyor / GitHub Actions | Azure Pipelines |
| Windows | Travis CI / Azure Pipelines | AppVeyor / GitHub Actions | Azure Pipelines |

> ¹ Python version not really pinned, but dependent on the (default) version of image used.
Expand Down
8 changes: 4 additions & 4 deletions cibuildwheel/bashlex_eval.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shlex
import subprocess

from typing import Dict, List, NamedTuple, Optional
from typing import Dict, NamedTuple

import bashlex # type: ignore

Expand Down Expand Up @@ -45,20 +45,20 @@ 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
part_end = part.pos[1] - word_start

# 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))
Expand Down
11 changes: 4 additions & 7 deletions cibuildwheel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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

Expand Down Expand Up @@ -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')
)

Expand Down
4 changes: 2 additions & 2 deletions cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -107,6 +106,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")
Expand Down

0 comments on commit 84ec4a3

Please sign in to comment.