2015-07-03 10:29:48 -04:00
|
|
|
# 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.
|
|
|
|
|
2015-07-03 11:18:38 -04:00
|
|
|
# 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'.
|
|
|
|
|
2023-04-07 11:08:53 -04:00
|
|
|
# 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
|
2020-10-03 11:33:36 -04:00
|
|
|
# CHANGELOG
|
|
|
|
# bs4/__init__.py
|
2025-02-02 10:23:53 -05:00
|
|
|
# doc/index.rst
|
2020-10-03 11:33:36 -04:00
|
|
|
|
2024-03-14 11:57:23 -04:00
|
|
|
pyenv activate bs4-test
|
2023-04-05 10:49:29 -04:00
|
|
|
hatch clean
|
|
|
|
tox run-parallel
|
2015-07-03 10:29:48 -04:00
|
|
|
|
2023-04-05 10:49:29 -04:00
|
|
|
# Build sdist and wheel.
|
|
|
|
hatch build
|
2020-05-30 14:30:58 -04:00
|
|
|
|
2025-08-24 10:57:55 -04:00
|
|
|
# Install the sdist locally and run unit tests. Note that we run the tests from the original source tree because
|
|
|
|
# the tests are no longer installed (tarball) or packaged (wheel)
|
2025-02-04 15:06:06 -05:00
|
|
|
pyenv virtualenv-delete -f py3-install-test-virtualenv
|
2025-02-02 13:45:44 -05:00
|
|
|
pyenv virtualenv 3.13.1 py3-install-test-virtualenv
|
2025-01-06 15:54:41 -05:00
|
|
|
pyenv activate py3-install-test-virtualenv
|
2023-04-07 11:08:53 -04:00
|
|
|
pip install dist/beautifulsoup4-*.tar.gz pytest lxml html5lib soupsieve
|
2025-08-24 10:57:55 -04:00
|
|
|
python -m pytest bs4/tests
|
2015-07-03 10:29:48 -04:00
|
|
|
echo "EXPECT HTML ON LINE BELOW"
|
2025-01-06 15:54:41 -05:00
|
|
|
(cd .. && python --version && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'lxml'))")
|
2023-04-05 10:49:29 -04:00
|
|
|
# That should print something like:
|
2025-02-02 13:45:44 -05:00
|
|
|
# Python 3.13.1
|
2023-04-05 10:49:29 -04:00
|
|
|
# [new version number] <a>foo</a>
|
|
|
|
|
2023-04-07 11:08:53 -04:00
|
|
|
|
2025-08-24 10:57:55 -04:00
|
|
|
# Install the wheel locally and test basic functionality.
|
2023-04-07 11:08:53 -04:00
|
|
|
pip uninstall beautifulsoup4
|
|
|
|
pip install dist/beautifulsoup4-*.whl
|
2025-08-24 10:57:55 -04:00
|
|
|
python -m pytest bs4/tests
|
2023-04-07 11:08:53 -04:00
|
|
|
echo "EXPECT HTML ON LINE BELOW"
|
2025-01-06 15:54:41 -05:00
|
|
|
(cd .. && python --version && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'lxml'))")
|
2023-04-07 11:08:53 -04:00
|
|
|
|
2025-01-06 15:54:41 -05:00
|
|
|
pyenv deactivate
|
2025-02-04 15:06:06 -05:00
|
|
|
pyenv virtualenv-delete -f py3-install-test-virtualenv
|
2015-07-03 10:29:48 -04:00
|
|
|
|
2023-04-05 10:49:29 -04:00
|
|
|
# Upload to test pypi
|
2025-01-06 15:54:41 -05:00
|
|
|
pyenv activate bs4-test
|
2023-04-05 10:49:29 -04:00
|
|
|
hatch publish -r test
|
2021-09-07 20:17:18 -04:00
|
|
|
|
2023-04-07 11:08:53 -04:00
|
|
|
# Test install from test pypi.
|
2025-02-02 14:00:57 -05:00
|
|
|
pyenv virtualenv 3.13.1 py3-install-test-virtualenv
|
|
|
|
pyenv activate py3-install-test-virtualenv
|
|
|
|
pip install pytest lxml html5lib soupsieve typing-extensions hatchling
|
2023-04-07 11:08:53 -04:00
|
|
|
|
|
|
|
# First, install from source and run the tests.
|
2025-02-02 14:00:57 -05:00
|
|
|
pip install -i https://test.pypi.org/simple/ beautifulsoup4 --extra-index-url=https://pypi.python.org/pypi --no-binary beautifulsoup4
|
2025-08-24 10:57:55 -04:00
|
|
|
python -m pytest bs4/tests
|
2015-07-03 10:29:48 -04:00
|
|
|
echo "EXPECT HTML ON LINE BELOW"
|
2023-04-05 10:49:29 -04:00
|
|
|
(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'lxml'))")
|
|
|
|
# That should print something like:
|
2025-02-02 14:00:57 -05:00
|
|
|
# /home/leonardr/.pyenv/shims/python
|
2023-04-05 10:49:29 -04:00
|
|
|
# [new version number] <a>foo</a>
|
2023-04-07 11:08:53 -04:00
|
|
|
|
2025-04-17 14:39:31 -04:00
|
|
|
# Next, install the wheel and test basic functionality.
|
2023-04-07 11:08:53 -04:00
|
|
|
pip uninstall beautifulsoup4
|
2025-02-03 07:16:41 -05:00
|
|
|
pip install -i https://test.pypi.org/simple/ beautifulsoup4 --extra-index-url=https://pypi.python.org/pypi --no-binary beautifulsoup4
|
2025-08-24 10:57:55 -04:00
|
|
|
python -m pytest bs4/tests
|
2023-04-07 11:08:53 -04:00
|
|
|
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>
|
|
|
|
|
2025-02-04 15:06:06 -05:00
|
|
|
pyenv virtualenv-delete -f py3-install-test-virtualenv
|
2015-07-03 11:18:38 -04:00
|
|
|
|
2023-04-05 10:49:29 -04:00
|
|
|
# Upload to production pypi
|
2025-02-02 14:00:57 -05:00
|
|
|
pyenv activate bs4-test
|
2023-04-05 10:49:29 -04:00
|
|
|
hatch publish
|
2018-07-30 20:19:51 -04:00
|
|
|
|
2021-09-07 20:17:18 -04:00
|
|
|
# Test install from production pypi
|
2015-07-03 11:25:17 -04:00
|
|
|
|
2023-04-07 11:08:53 -04:00
|
|
|
# First, from the source distibution
|
2025-02-04 15:06:06 -05:00
|
|
|
pyenv virtualenv-delete -f py3-install-test-virtualenv
|
2025-02-02 14:00:57 -05:00
|
|
|
pyenv virtualenv py3-install-test-virtualenv
|
2025-02-03 07:16:41 -05:00
|
|
|
pyenv activate py3-install-test-virtualenv
|
2025-02-02 14:00:57 -05:00
|
|
|
|
2023-04-07 11:08:53 -04:00
|
|
|
pip install pytest lxml html5lib beautifulsoup4 --no-binary beautifulsoup4
|
2025-08-24 10:57:55 -04:00
|
|
|
python -m pytest bs4/tests
|
2023-04-07 11:08:53 -04:00
|
|
|
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
|
2015-07-03 11:25:17 -04:00
|
|
|
pip install beautifulsoup4
|
2025-08-24 10:57:55 -04:00
|
|
|
python -m pytest bs4/tests
|
2015-07-03 11:25:17 -04:00
|
|
|
echo "EXPECT HTML ON LINE BELOW"
|
2023-04-05 10:49:29 -04:00
|
|
|
(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('<a>foo', 'html.parser'))")
|
2023-04-07 11:08:53 -04:00
|
|
|
# That should print something like:
|
|
|
|
# /home/.../py3-install-test-virtualenv/bin/python
|
|
|
|
# [new version number] <a>foo</a>
|
|
|
|
|
|
|
|
# Cleanup
|
2025-02-04 15:06:06 -05:00
|
|
|
pyenv virtualenv-delete -f py3-install-test-virtualenv
|
2025-08-24 10:57:55 -04:00
|
|
|
|
|
|
|
# Copy source distro
|
2025-09-29 05:47:12 -04:00
|
|
|
scp dist/beautifulsoup4-*.tar.gz crummy.com:public_html/software/BeautifulSoup/bs4/download/4.14/
|
2025-08-24 10:57:55 -04:00
|
|
|
|
|
|
|
# Refresh docs
|
2025-09-29 05:47:12 -04:00
|
|
|
pyenv activate bs4-test
|
2025-08-24 10:57:55 -04:00
|
|
|
cd doc
|
|
|
|
make clean; rm -rf _build build
|
|
|
|
make html
|
|
|
|
rsync -avp _build/html/* crummy.com:public_html/software/BeautifulSoup/bs4/doc/
|