Skip to content

Commit fd56ca0

Browse files
authored
Merge pull request #62 from altendky/add_no_cache_and_jobs_arguments
Add --no-cache and --jobs arguments
2 parents 2ce7aa9 + 0a3a28a commit fd56ca0

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

Dockerfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ ARG PYQT_DATA_VISUALIZATION_VERSION="5.14.0"
99
ARG PYQT_PURCHASING_VERSION="5.14.0"
1010
ARG PYQT_WEB_ENGINE_VERSION="5.14.0"
1111

12+
ARG MAKEFLAGS=""
13+
1214
################################################################################
1315
# Build dependencies
1416
################################################################################
@@ -68,7 +70,8 @@ RUN pacman --noconfirm -S \
6870

6971
FROM build-dep AS pyqt5
7072

71-
# Reuse argument from previous build scope
73+
# Reuse arguments from previous build scope
74+
ARG MAKEFLAGS
7275
ARG PYQT_VERSION
7376

7477
# Download source tar
@@ -101,7 +104,8 @@ RUN find /upstream/ -name \*.pyi -exec cp {} . \;
101104

102105
FROM build-dep AS pyqt-3d
103106

104-
# Reuse argument from previous build scope
107+
# Reuse arguments from previous build scope
108+
ARG MAKEFLAGS
105109
ARG PYQT_3D_VERSION
106110

107111
# Download source tar
@@ -133,7 +137,8 @@ RUN find /upstream/ -name \*.pyi -exec cp {} . \;
133137

134138
FROM build-dep AS pyqt-chart
135139

136-
# Reuse argument from previous build scope
140+
# Reuse arguments from previous build scope
141+
ARG MAKEFLAGS
137142
ARG PYQT_CHART_VERSION
138143

139144
# Download source tar
@@ -165,7 +170,8 @@ RUN find /upstream/ -name \*.pyi -exec cp {} . \;
165170

166171
FROM build-dep AS pyqt-data-visualization
167172

168-
# Reuse argument from previous build scope
173+
# Reuse arguments from previous build scope
174+
ARG MAKEFLAGS
169175
ARG PYQT_DATA_VISUALIZATION_VERSION
170176

171177
# Download source tar
@@ -197,7 +203,8 @@ RUN find /upstream/ -name \*.pyi -exec cp {} . \;
197203

198204
FROM build-dep AS pyqt-purchasing
199205

200-
# Reuse argument from previous build scope
206+
# Reuse arguments from previous build scope
207+
ARG MAKEFLAGS
201208
ARG PYQT_PURCHASING_VERSION
202209

203210
# Download source tar
@@ -229,7 +236,8 @@ RUN find /upstream/ -name \*.pyi -exec cp {} . \;
229236

230237
FROM build-dep AS pyqt-web-engine
231238

232-
# Reuse argument from previous build scope
239+
# Reuse arguments from previous build scope
240+
ARG MAKEFLAGS
233241
ARG PYQT_WEB_ENGINE_VERSION
234242

235243
# Download source tar

build_upstream.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ def parse_args() -> argparse.Namespace:
2828
help="Directory to find package(s) to be built. "
2929
"Defaults to ./pkg")
3030

31+
# noinspection PyTypeChecker
32+
parser.add_argument('-j', '--jobs', type=int,
33+
default=1,
34+
help="The number of jobs to launch in parallel. "
35+
"Defaults to 1")
36+
37+
# noinspection PyTypeChecker
38+
parser.add_argument('--no-cache',
39+
action='store_true',
40+
help="Do not use Docker caches. Defaults to false")
41+
3142
return parser.parse_args()
3243

3344

@@ -36,20 +47,22 @@ def main():
3647

3748
docker_client = docker.from_env()
3849

39-
image_id = build_image(docker_client, args.dockerfile)
50+
image_id = build_image(docker_client, args.dockerfile, args.jobs, args.no_cache)
4051

4152
extract_output(docker_client, image_id, args.output_dir)
4253

4354

44-
def build_image(docker_client: DockerClient, dockerfile: Path) -> str:
55+
def build_image(docker_client: DockerClient, dockerfile: Path, jobs: int, no_cache: bool) -> str:
4556
image_name = "pyqt5-stubs"
4657

4758
# Using low-level API so that we can log as it occurs instead of only
4859
# after build has finished/failed
4960
resp = docker_client.api.build(
5061
path=str(dockerfile.parent),
5162
rm=True,
52-
tag=image_name)
63+
tag=image_name,
64+
buildargs={"MAKEFLAGS": f"-j{jobs}"},
65+
nocache=no_cache)
5366

5467
image_id: str = typing.cast(str, None)
5568
for chunk in json_stream(resp):

0 commit comments

Comments
 (0)