-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare-release.sh
106 lines (86 loc) · 3.9 KB
/
prepare-release.sh
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
# A script to automatically create and test source and wheel
# distributions of Beautiful Soup.
# Recommend you run these steps one at a time rather than just running
# the script.
# If you screwed up on the test server and have to create a "a" or "b"
# release the second time, add the '--pre' argument to pip install to
# find the 'prerelease'.
# At some point I'll become confident enough with hatch and tox
# that it won't be necessary to do so many install and test steps.
# First, change the version number in
# CHANGELOG
# bs4/__init__.py
# doc/source/index.rst
pyenv activate bs4-test
hatch clean
tox run-parallel
# Build sdist and wheel.
hatch build
# Test the sdist locally.
rm -rf ../py3-install-test-virtualenv
virtualenv -p /usr/bin/python3 ../py3-install-test-virtualenv
source ../py3-install-test-virtualenv/bin/activate
pip install dist/beautifulsoup4-*.tar.gz pytest lxml html5lib soupsieve
python -m pytest ../py3-install-test-virtualenv/lib/python3.11/site-packages/bs4/tests/
echo "EXPECT HTML ON LINE BELOW"
(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'lxml'))")
# That should print something like:
# /home/.../py3-install-test-virtualenv/bin/python
# [new version number] <a>foo</a>
# Test the wheel locally.
pip uninstall beautifulsoup4
pip install dist/beautifulsoup4-*.whl
echo "EXPECT HTML ON LINE BELOW"
(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'lxml'))")
deactivate
rm -rf ../py3-install-test-virtualenv
# Upload to test pypi
hatch publish -r test
# Test install from test pypi.
rm -rf ../py3-install-test-virtualenv
virtualenv -p /usr/bin/python3 ../py3-install-test-virtualenv
source ../py3-install-test-virtualenv/bin/activate
pip install pytest lxml html5lib
# First, install from source and run the tests.
pip install -i https://testpypi.python.org/pypi beautifulsoup4 --extra-index-url=https://pypi.python.org/pypi --no-binary beautifulsoup4
python -m pytest ../py3-install-test-virtualenv/lib/python3.11/site-packages/bs4/tests/
echo "EXPECT HTML ON LINE BELOW"
(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'lxml'))")
# That should print something like:
# /home/.../py3-install-test-virtualenv/bin/python
# [new version number] <a>foo</a>
# Next, install the wheel and just test functionality.
pip uninstall beautifulsoup4
pip install -i https://testpypi.python.org/pypi beautifulsoup4 --extra-index-url=https://pypi.python.org/pypi
echo "EXPECT HTML ON LINE BELOW"
(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'lxml'))")
# That should print something like:
# /home/.../py3-install-test-virtualenv/bin/python
# [new version number] <a>foo</a>
deactivate
rm -rf ../py3-install-test-virtualenv
# Upload to production pypi
hatch publish
# Test install from production pypi
# First, from the source distibution
rm -rf ../py3-install-test-virtualenv
virtualenv -p /usr/bin/python3 ../py3-install-test-virtualenv
source ../py3-install-test-virtualenv/bin/activate
pip install pytest lxml html5lib beautifulsoup4 --no-binary beautifulsoup4
python -m pytest ../py3-install-test-virtualenv/lib/python3.11/site-packages/bs4/tests/
echo "EXPECT HTML ON LINE BELOW"
(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'html.parser'))")
# That should print something like:
# /home/.../py3-install-test-virtualenv/bin/python
# [new version number] <a>foo</a>
# Next, from the wheel
pip uninstall beautifulsoup4
pip install beautifulsoup4
echo "EXPECT HTML ON LINE BELOW"
(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'html.parser'))")
# That should print something like:
# /home/.../py3-install-test-virtualenv/bin/python
# [new version number] <a>foo</a>
# Cleanup
deactivate
rm -rf ../py3-install-test-virtualenv