Skip to content

Commit

Permalink
Merge pull request #26 from natefoo/pysam-0.22.0
Browse files Browse the repository at this point in the history
Update pysam to 0.22.0
  • Loading branch information
natefoo authored Nov 29, 2023
2 parents ba0a2a8 + 1b64395 commit 5bf9725
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 7 additions & 1 deletion recipes/pysam/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
name: pysam
version: 0.21.0
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
run_in_sdist_before:
- curl -Lo htslib/hts_probe_cc.sh 'https://raw.githubusercontent.com/pysam-developers/pysam/v0.22.0/htslib/hts_probe_cc.sh'
- chmod +x htslib/hts_probe_cc.sh
- sed -i 's/^test-.*//' pyproject.toml
18 changes: 15 additions & 3 deletions wheel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
package_name = meta["name"]
package_version = meta["version"]
is_package_pure = meta.get("purepy", False)
run_in_sdist = meta.get("run_in_sdist", False)
run_in_sdist_before = meta.get("run_in_sdist_before", [])

# 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"
Expand Down Expand Up @@ -60,7 +62,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_sdist:
tar_temp_dir = Path(tempfile.mkdtemp(dir=temp_dir))
with tarfile.open(sdist_filepath) as tar:
tar.extractall(path=tar_temp_dir)
Expand All @@ -70,11 +76,17 @@
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_sdist:
commands.append(f"cd '{extracted_sdist_dir}'")
commands.extend(run_in_sdist_before)
commands.append(f"cibuildwheel --output-dir '{wheelhouse}' '{package_path}'")
joined_command = " && ".join(commands)
joined_check_command = " && ".join(check_commands)

Expand Down

0 comments on commit 5bf9725

Please sign in to comment.