Skip to content

Commit

Permalink
Save the time for cleanup / back to run (#113)
Browse files Browse the repository at this point in the history
* Save the time for cleanup / back to run

* fix runtime
  • Loading branch information
pvizeli authored Jul 8, 2020
1 parent 4800734 commit 5bfd6b6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion builder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"--remote", required=True, type=str, help="Remote URL pass to upload plugin."
)
@click.option(
"--timeout", default=330, type=int, help="Max runtime for pip before abort."
"--timeout", default=345, type=int, help="Max runtime for pip before abort."
)
def builder(
apk: str,
Expand Down
6 changes: 3 additions & 3 deletions builder/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def build_wheels_package(
constraint_cmd = f"--constraint {constraint}" if constraint else ""

run_command(
f'pip3 wheel --progress-bar off --no-binary "{skip_binary}" --wheel-dir {output} --find-links {index} {constraint_cmd} "{package}"',
f'pip3 wheel --progress-bar off --no-clean --no-binary "{skip_binary}" --wheel-dir {output} --find-links {index} {constraint_cmd} "{package}"',
env=build_env,
timeout=timeout,
)
Expand All @@ -50,7 +50,7 @@ def build_wheels_requirement(
constraint_cmd = f"--constraint {constraint}" if constraint else ""

run_command(
f'pip3 wheel --progress-bar off --no-binary "{skip_binary}" --wheel-dir {output} --find-links {index} {constraint_cmd} --requirement {requirement}',
f'pip3 wheel --progress-bar off --no-clean --no-binary "{skip_binary}" --wheel-dir {output} --find-links {index} {constraint_cmd} --requirement {requirement}',
env=build_env,
timeout=timeout,
)
Expand All @@ -65,7 +65,7 @@ def build_wheels_local(index: str, output: Path) -> None:
build_env["MAKEFLAGS"] = f"-j{cpu}"

run_command(
f"pip3 wheel --progress-bar off --wheel-dir {output} --find-links {index} .",
f"pip3 wheel --progress-bar off --no-clean --wheel-dir {output} --find-links {index} .",
env=build_env,
)

Expand Down
21 changes: 3 additions & 18 deletions builder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from pathlib import Path
import os
import re
import signal
import subprocess
import sys
from typing import Optional, Dict
Expand Down Expand Up @@ -43,26 +42,12 @@ def run_command(
cmd: str, env: Optional[Dict[str, str]] = None, timeout: Optional[int] = None
) -> None:
"""Implement subprocess.run but handle timeout different."""
# pylint: disable=subprocess-popen-preexec-fn
process = subprocess.Popen(
subprocess.run(
cmd,
shell=True,
check=True,
stdout=sys.stdout,
stderr=sys.stderr,
stdin=subprocess.DEVNULL,
env=env,
preexec_fn=os.setsid,
timeout=timeout,
)

# Run command and wait
try:
process.communicate(timeout=timeout)
except Exception:
os.kill(os.getpgid(process.pid), signal.SIGTERM)
raise

# Process return code
if process.returncode == 0:
return

raise subprocess.CalledProcessError(process.returncode, cmd)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

VERSION = "1.12.2"
VERSION = "1.12.3"

setup(
name="builder",
Expand Down

0 comments on commit 5bfd6b6

Please sign in to comment.