Skip to content

Commit

Permalink
Add option to skip binary (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli authored Mar 21, 2020
1 parent 00989a3 commit 45f3399
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 8 additions & 2 deletions builder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
@click.option("--apk", default="build-base", help="APKs they are needed to build this.")
@click.option("--pip", default="Cython", help="PiPy modules needed to build this.")
@click.option("--index", required=True, help="Index URL of remote wheels repository.")
@click.option(
"--skip-binary", default=":none:", help="List of packages to skip wheels from pypi."
)
@click.option(
"--requirement",
type=click_pathlib.Path(exists=True),
Expand Down Expand Up @@ -59,6 +62,7 @@ def builder(
apk: str,
pip: str,
index: str,
skip_binary: str,
requirement: Optional[Path],
requirement_diff: Optional[Path],
prebuild_dir: Optional[Path],
Expand Down Expand Up @@ -94,7 +98,7 @@ def builder(
for package in packages:
print(f"Process package: {package}", flush=True)
try:
build_wheels_package(package, wheels_index, wheels_dir)
build_wheels_package(package, wheels_index, wheels_dir, skip_binary)
except CalledProcessError:
exit_code = 109
else:
Expand All @@ -104,7 +108,9 @@ def builder(
write_requirement(temp_requirement, packages)

try:
build_wheels_requirement(temp_requirement, wheels_index, wheels_dir)
build_wheels_requirement(
temp_requirement, wheels_index, wheels_dir, skip_binary
)
except CalledProcessError:
exit_code = 109

Expand Down
12 changes: 8 additions & 4 deletions builder/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from typing import List, Optional


def build_wheels_package(package: str, index: str, output: Path) -> None:
def build_wheels_package(
package: str, index: str, output: Path, skip_binary: str
) -> None:
"""Build wheels from a requirements file into output."""
cpu = os.cpu_count() or 4

Expand All @@ -15,7 +17,7 @@ def build_wheels_package(package: str, index: str, output: Path) -> None:
build_env["MAKEFLAGS"] = f"-j{cpu}"

subprocess.run(
f'pip3 wheel --progress-bar off --wheel-dir {output} --find-links {index} "{package}"',
f'pip3 wheel --progress-bar off --no-binary "{skip_binary}" --wheel-dir {output} --find-links {index} "{package}"',
shell=True,
check=True,
stdout=sys.stdout,
Expand All @@ -24,7 +26,9 @@ def build_wheels_package(package: str, index: str, output: Path) -> None:
)


def build_wheels_requirement(requirement: Path, index: str, output: Path) -> None:
def build_wheels_requirement(
requirement: Path, index: str, output: Path, skip_binary: str
) -> None:
"""Build wheels from a requirements file into output."""
cpu = os.cpu_count() or 4

Expand All @@ -33,7 +37,7 @@ def build_wheels_requirement(requirement: Path, index: str, output: Path) -> Non
build_env["MAKEFLAGS"] = f"-j{cpu}"

subprocess.run(
f"pip3 wheel --progress-bar off --wheel-dir {output} --find-links {index} --requirement {requirement}",
f'pip3 wheel --progress-bar off --no-binary "{skip_binary}" --wheel-dir {output} --find-links {index} --requirement {requirement}',
shell=True,
check=True,
stdout=sys.stdout,
Expand Down

0 comments on commit 45f3399

Please sign in to comment.