-
Notifications
You must be signed in to change notification settings - Fork 2
/
nightly
executable file
·131 lines (110 loc) · 4.26 KB
/
nightly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#! /bin/bash
set -e -u
# non tools.pywikibot should not be able to tamper with this
umask 0022
# delete the venv, if it already exists
rm -rf .kube_venv
# create fresh venv
python3 -m venv .kube_venv
# activate it
source .kube_venv/bin/activate
# upgrade pip inside the venv and add support for setuptools
pip install -U pip setuptools
# Create version file
function create_version {
echo "$1" > $2
git rev-list HEAD --count >> $2
date +%Y-%m-%dT%H:%M:%S >> $2
git rev-parse --short HEAD >> $2
}
function finish {
rm -rf "$TMPDIR"
echo Cleaned up $TMPDIR
}
TMPDIR=$(mktemp -d)
echo Building new public_html in $TMPDIR on `hostname`...
trap finish EXIT
cd $TMPDIR
echo Step 1: Collecting mwparserfromhell...
git -c advice.detachedHead=false clone -q --depth 1 -b v0.6.5 https://github.com/earwig/mwparserfromhell.git
(cd mwparserfromhell && python3 setup.py -q build && git gc --aggressive --prune=all --quiet)
echo Step 2: Collecting setuptools...
# T284299
git -c advice.detachedHead=false clone -q --depth 1 -b v68.0.0 https://github.com/pypa/setuptools.git
(cd setuptools && python3 setup.py -q build && git gc --aggressive --prune=all --quiet)
echo Step 3: Collecting importlib_metadata for Python 3.7...
# currently needed for Pywikibot 9.0 (core)
git -c advice.detachedHead=false clone -q --depth 1 -b v6.7.0 https://github.com/python/importlib_metadata.git
(cd importlib_metadata
python3 -c "import setuptools; setuptools.setup()" -q build
git gc --aggressive --prune=all --quiet
)
echo Step 4: Collecting typing_extensions for importlib_metadata...
# currently needed for Pywikibot 9.0 (core)
git -c advice.detachedHead=false clone -q --depth 1 -b 4.7.1 https://github.com/python/typing_extensions.git
cp -R typing_extensions typing_extensions.temp
(cd typing_extensions.temp
# copy newer setuptools to build package with pyproject.toml
cp -a ../setuptools/build/lib*/. .
python3 -c "from setuptools import setuptools; setuptools.setup()" -q build
git gc --aggressive --prune=all --quiet
)
echo Step 5: Collecting zipp for importlib_metadata...
# currently needed for Pywikibot 9.0 (core)
git -c advice.detachedHead=false clone -q --depth 1 -b v3.15.0 https://github.com/jaraco/zipp.git
(cd zipp
python3 -c "import setuptools; setuptools.setup()" -q build
git gc --aggressive --prune=all --quiet
)
echo Step 6: Build core master
# Current version of core
git clone -q --depth 1 https://gerrit.wikimedia.org/r/pywikibot/core.git
(cd core
create_version "nightly/core" "pywikibot/version"
git gc --aggressive --prune=all --quiet
(cd scripts
git clone -q --depth 1 https://gerrit.wikimedia.org/r/pywikibot/i18n.git
(cd i18n && git gc --aggressive --prune=all --quiet)
)
cp -a ../importlib_metadata/build/lib*/. .
cp -a ../mwparserfromhell/build/lib*/. .
cp -a ../typing_extensions.temp/build/lib*/. .
cp -a ../zipp/build/lib*/. .
cp -a ../setuptools/build/lib*/. .
(cd setuptools && ln -s ../pkg_resources . && ln -s ../_distutils_hack .)
)
echo Step 7: Build core stable
# Create a stable version of core. Bugs T98592 and T217236
git clone -q --depth 1 -b stable https://gerrit.wikimedia.org/r/pywikibot/core.git core_stable
(cd core_stable
create_version "nightly/core_stable" "pywikibot/version"
git gc --aggressive --prune=all --quiet
(cd scripts
git clone -q --depth 1 https://gerrit.wikimedia.org/r/pywikibot/i18n.git
(cd i18n && git gc --aggressive --prune=all --quiet)
)
cp -a ../mwparserfromhell/build/lib*/. .
cp -a ../setuptools/build/lib*/. .
(cd setuptools && ln -s ../pkg_resources . && ln -s ../_distutils_hack .)
)
echo Step 8: zip ALL the things
zip -9 -r -q core.zip core
zip -9 -r -q core_stable.zip core_stable
echo Step 9: tar ALL the things
tar czPf core.tar.gz core/
tar czPf core_stable.tar.gz core_stable/
echo Step 10: Copy static files
cp -R /data/project/pywikibot/nightly-source/_static/. .
echo Step 11: Remove old stuff
# uncomment for debugging:
# set
rm -rf typing_extensions.temp
cd /data/project/pywikibot/
rm -rf public_html.new
rm -rf public_html.old
echo Step 12: Create public_html.new from temp
mv $TMPDIR public_html.new
chmod 755 public_html.new
echo Step 13: Do the magic switcharoo
mv public_html public_html.old
mv public_html.new public_html