@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import re
|
||||
import pytest
|
||||
import textwrap
|
||||
@@ -39,11 +38,9 @@ VERSION_REGEX = r'([\w-]+)==([^\s]+)'
|
||||
|
||||
|
||||
def get_versions_from_constraint_file(constraint_file):
|
||||
with open(constraint_file, encoding='utf8') as f:
|
||||
constraint_file_text = f.read()
|
||||
constraint_file_text = constraint_file.read_text(encoding='utf8')
|
||||
|
||||
versions = {}
|
||||
|
||||
for package, version in re.findall(VERSION_REGEX, constraint_file_text):
|
||||
versions[package] = version
|
||||
|
||||
@@ -73,7 +70,7 @@ def test_pinned_versions(tmp_path, python_version):
|
||||
constraint_filename = 'constraints.txt'
|
||||
build_pattern = '[cp]p38-*'
|
||||
|
||||
constraint_file = os.path.join(cibuildwheel.util.resources_dir, constraint_filename)
|
||||
constraint_file = cibuildwheel.util.resources_dir / constraint_filename
|
||||
constraint_versions = get_versions_from_constraint_file(constraint_file)
|
||||
|
||||
for package in ['pip', 'setuptools', 'wheel', 'virtualenv']:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import jinja2
|
||||
|
||||
from typing import Union, Dict, Any
|
||||
|
||||
|
||||
@@ -23,12 +25,12 @@ class TestProject:
|
||||
self.files = {}
|
||||
self.template_context = {}
|
||||
|
||||
def generate(self, path: str):
|
||||
def generate(self, path: Path):
|
||||
for filename, content in self.files.items():
|
||||
file_path = os.path.join(path, filename)
|
||||
os.makedirs(os.path.dirname(file_path), exist_ok=True)
|
||||
file_path = path / filename
|
||||
file_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with open(file_path, 'w', encoding='utf8') as f:
|
||||
with file_path.open('w', encoding='utf8') as f:
|
||||
if isinstance(content, jinja2.Template):
|
||||
content = content.render(self.template_context)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import jinja2
|
||||
|
||||
@@ -35,7 +35,7 @@ def test(capfd, tmp_path):
|
||||
project_dir = tmp_path / 'project'
|
||||
subdir_package_project.generate(project_dir)
|
||||
|
||||
package_dir = os.path.join('src', 'spam')
|
||||
package_dir = Path('src', 'spam')
|
||||
# build the wheels
|
||||
actual_wheels = utils.cibuildwheel_run(project_dir, package_dir=package_dir, add_env={
|
||||
'CIBW_BEFORE_BUILD': 'python {project}/bin/before_build.py',
|
||||
|
||||
+3
-2
@@ -10,9 +10,10 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from tempfile import mkdtemp
|
||||
|
||||
IS_WINDOWS_RUNNING_ON_AZURE = os.path.exists('C:\\hostedtoolcache')
|
||||
IS_WINDOWS_RUNNING_ON_AZURE = Path('C:\\hostedtoolcache').exists()
|
||||
IS_WINDOWS_RUNNING_ON_TRAVIS = os.environ.get('TRAVIS_OS_NAME') == 'windows'
|
||||
|
||||
|
||||
@@ -66,7 +67,7 @@ def cibuildwheel_run(project_path, package_dir='.', env=None, add_env=None, outp
|
||||
|
||||
with TemporaryDirectoryIfNone(output_dir) as _output_dir:
|
||||
subprocess.check_call(
|
||||
[sys.executable, '-m', 'cibuildwheel', '--output-dir', str(_output_dir), package_dir],
|
||||
[sys.executable, '-m', 'cibuildwheel', '--output-dir', str(_output_dir), str(package_dir)],
|
||||
env=env,
|
||||
cwd=project_path,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user