Skip to content

Commit a4e6e73

Browse files
committed
update build command to run tests for a specific library
1 parent 0e89af2 commit a4e6e73

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

.generator/Dockerfile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,12 @@ RUN for PYTHON_VERSION in 3.9.23 3.10.18 3.11.13 3.12.11 3.13.5; do \
4747
./configure --enable-optimizations && \
4848
make altinstall && \
4949
cd / && \
50-
rm -rf Python-${PYTHON_VERSION}* \
50+
rm -rf Python-${PYTHON_VERSION}* && \
51+
# Install pip using the instructions below
52+
# https://pip.pypa.io/en/stable/installation/#ensurepip
53+
python${PYTHON_VERSION} -m ensurepip --upgrade \
5154
; done
5255

53-
RUN wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py'
54-
55-
# Ensure Pip for all python3 versions
56-
RUN python3.9 /tmp/get-pip.py
57-
RUN python3.10 /tmp/get-pip.py
58-
RUN python3.11 /tmp/get-pip.py
59-
RUN python3.12 /tmp/get-pip.py
60-
RUN python3.13 /tmp/get-pip.py
61-
62-
RUN rm /tmp/get-pip.py
63-
6456
# Test Pip
6557
RUN python3.9 -m pip
6658
RUN python3.10 -m pip

.generator/cli.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,16 @@ def _run_nox_sessions(sessions:List[str]):
120120
Args:
121121
path (List[str]): The list of nox sessions to run.
122122
"""
123-
for nox_session in sessions:
124-
command = ["nox", "-s", nox_session]
125-
result = subprocess.run(command, capture_output=True, text=True, check=True)
126-
logger.info(result)
127-
123+
# Read a generate-request.json file
124+
try:
125+
request_data = _read_json_file(f"{LIBRARIAN_DIR}/{GENERATE_REQUEST_FILE}")
126+
library_id = request_data.get("id")
127+
for nox_session in sessions:
128+
command = ["nox", "-s", nox_session, "-f", f"{SOURCE_DIR}/packages/{library_id}"]
129+
result = subprocess.run(command, capture_output=True, text=True, check=True)
130+
logger.info(result)
131+
except Exception as e:
132+
raise ValueError("Generation failed.") from e
128133

129134
def handle_build():
130135
"""The main coordinator for validating client library generation."""

0 commit comments

Comments
 (0)