diff --git a/recipes/pysam/meta.yaml b/recipes/pysam/meta.yaml index fd6cdf3..968786d 100644 --- a/recipes/pysam/meta.yaml +++ b/recipes/pysam/meta.yaml @@ -1,3 +1,5 @@ --- name: pysam version: 0.22.0 +# as of 0.22.0 {project} in pyproject.toml [tool.cibuildwheel] expects to be the package dir +run_in_sdist: true diff --git a/wheel_builder.py b/wheel_builder.py index b862277..a57b22f 100644 --- a/wheel_builder.py +++ b/wheel_builder.py @@ -29,6 +29,7 @@ package_name = meta["name"] package_version = meta["version"] is_package_pure = meta.get("purepy", False) + run_in_sdist = meta.get("run_in_sdist", False) # Find the sdist url using the PyPI warehouse API https://warehouse.pypa.io/api-reference/json.html pypi_url = f"https://pypi.org/pypi/{package_name}/{package_version}/json" @@ -60,7 +61,11 @@ env_file = os.path.join(folder, "env.sh") if os.path.exists(env_file): commands.append(f". '{env_file}'") - if is_package_pure: + + extracted_sdist_dir = None + package_path = sdist_filepath + wheelhouse = os.path.join(os.getcwd(), "wheelhouse") + if is_package_pure or run_in_dist: tar_temp_dir = Path(tempfile.mkdtemp(dir=temp_dir)) with tarfile.open(sdist_filepath) as tar: tar.extractall(path=tar_temp_dir) @@ -70,11 +75,16 @@ except ValueError: raise Exception("Invalid sdist: didn't contain a single directory") - commands.append(f"python3 -m build --wheel --outdir wheelhouse '{extracted_sdist_dir}'") + package_path = "." + + if is_package_pure: + commands.append(f"python3 -m build --wheel --outdir '{wheelhouse}' '{extracted_sdist_dir}'") else: check_commands = commands.copy() check_commands.append("cibuildwheel --print-build-identifiers") - commands.append(f"cibuildwheel --output-dir wheelhouse '{sdist_filepath}'") + if run_in_dist: + commands.append(f"cd '{extracted_sdist_dir}'") + commands.append(f"cibuildwheel --output-dir '{wheelhouse}' '{package_path}'") joined_command = " && ".join(commands) joined_check_command = " && ".join(check_commands)