@@ -33,11 +33,35 @@ git clone https://github.com/mozilla/pontoon.git $BUILD_DIR/$APP_NAME.git
33
33
cd $BUILD_DIR /$APP_NAME .git
34
34
git checkout $PONTOON_REV
35
35
36
- # Install Python dependencies
37
- python3 -m venv __env__
36
+ # Prepare Python Virtual Environment using uv if available else using venv
37
+ uv --version > /dev/null 2>&1 && uv venv __env__ || python3 -m venv __env__
38
38
source __env__/bin/activate
39
- pip install --upgrade pip==23.1.1 # Pip version fixed because it breaks pip-tools everytime...
40
- pip install -r requirements.txt
39
+
40
+ # Collect info about the environment
41
+ PYTHON_MAJOR=$( python -c " import sys;print(sys.version_info.major)" )
42
+ PYTHON_MINOR=$( python -c " import sys;print(sys.version_info.minor)" )
43
+ uv --version > /dev/null 2>&1 && UV_AVAILABLE=1 || UV_AVAILABLE=0
44
+
45
+ # Install uv in the venv if not available
46
+ if [ $UV_AVAILABLE != 1 ] ; then
47
+ pip install uv
48
+ fi
49
+
50
+ # Compile dependencies (Replicating: https://github.com/mozilla/pontoon/blob/d619331f62b28fd69d3f998d97e4343dd0ed6bc4/docker/compile_requirements.sh)
51
+ uv pip compile --generate-hashes requirements/default.in -o requirements/default.txt
52
+ uv pip compile --generate-hashes requirements/dev.in -o requirements/dev.txt
53
+ uv pip compile --generate-hashes requirements/lint.in -o requirements/lint.txt
54
+ uv pip compile --generate-hashes requirements/test.in -o requirements/test.txt
55
+
56
+ # Compile additional dependencies for Python 3.10
57
+ cp $DEBIAN_DIR /requirements.py310.in $BUILD_DIR /$APP_NAME .git/
58
+ uv pip compile --generate-hashes $BUILD_DIR /$APP_NAME .git/requirements.py310.in -o $OUTPUT_DIR /requirements.py310.txt
59
+
60
+ # Install Python dependencies
61
+ uv pip install -r requirements.txt
62
+ if [ $PYTHON_MAJOR == 3 ] && [ $PYTHON_MINOR -ge 12 ] ; then
63
+ uv pip install setuptools
64
+ fi
41
65
42
66
# Install Node dependencies
43
67
npm install
@@ -49,19 +73,17 @@ export DJANGO_DEBUG=True
49
73
50
74
# Build the front
51
75
npm run build:prod
52
- python3 manage.py collectstatic
76
+ uv run manage.py collectstatic
53
77
54
78
# Leave the virtualenv
55
79
deactivate
56
80
57
81
# Copy files
58
82
cp -vr static/ $OUTPUT_DIR
59
83
cp -vr pontoon/ $OUTPUT_DIR
60
- cp -vr tag-admin/ $OUTPUT_DIR
61
84
cp -vr translate/ $OUTPUT_DIR
62
85
cp -vr requirements/ $OUTPUT_DIR
63
86
cp -v setup.py $OUTPUT_DIR
64
- cp -v setup.cfg $OUTPUT_DIR
65
87
cp -v manage.py $OUTPUT_DIR
66
88
cp -v requirements.txt $OUTPUT_DIR
67
89
cp -v LICENSE $OUTPUT_DIR
0 commit comments