From b04d2ea329aa448a58ff3c715f2bad04feb2a70a Mon Sep 17 00:00:00 2001 From: Rachmadani Haryono Date: Sat, 21 Jan 2023 10:24:30 +0800 Subject: [PATCH 1/4] build(setup): change install_requires - move install_requires to variable for testing - certifi is required based on requirements.txt --- setup.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index e2c5f617..e5094d1f 100644 --- a/setup.py +++ b/setup.py @@ -49,6 +49,14 @@ "https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.2rc1.zip", ] ) +install_requires = [ + 'beautifulsoup4>=4.4.1', + 'certifi', + 'cryptography>=1.2.3', + 'html5lib>=1.0.1', + 'pyreadline; sys_platform == \'windows\'', + 'urllib3>=1.23', +] setup( name='buku', @@ -63,19 +71,13 @@ python_requires='>=3.7', # requires pip>=9.0.0 platforms=['any'], py_modules=['buku'], - install_requires=[ - 'beautifulsoup4>=4.4.1', - 'cryptography>=1.2.3', - 'urllib3>=1.23', - 'html5lib>=1.0.1', - ], + install_requires=install_requires, packages=find_packages(exclude=['tests']), include_package_data=True, entry_points={ 'console_scripts': ['buku=buku:main', 'bukuserver=bukuserver.server:cli'] }, extras_require={ - "ca-certificates": ["certifi"], "tests": tests_require + server_require + [reverse_proxy], "server": server_require, "reverse_proxy": [reverse_proxy], From 6e21e51144b6517dc834c8f26af3ebfc9b93f8de Mon Sep 17 00:00:00 2001 From: Rachmadani Haryono Date: Sat, 21 Jan 2023 10:27:21 +0800 Subject: [PATCH 2/4] test(setup): install_requires --- tests/test_setup.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/test_setup.py b/tests/test_setup.py index 9d4cef1d..c089ba64 100644 --- a/tests/test_setup.py +++ b/tests/test_setup.py @@ -1,15 +1,32 @@ import pathlib +import pytest -def test_bukuserver_requirement(monkeypatch): - def m_setup(**kwargs): + +@pytest.fixture +def setup_obj(monkeypatch): + def m_setup(**_): return None import setuptools monkeypatch.setattr(setuptools, 'setup', m_setup) import setup + return setup + + +def test_bukuserver_requirement(setup_obj): assert [ x for x in pathlib.Path("bukuserver/requirements.txt").read_text(encoding="utf8", errors="surrogateescape").splitlines() if "flask-reverse-proxy-fix" not in x - ] == setup.server_require + ] == setup_obj.server_require + + +def test_buku_requirement(setup_obj): + assert sorted( + [ + x + for x in pathlib.Path("requirements.txt").read_text(encoding="utf8", errors="surrogateescape").splitlines() + if not x.startswith('#') and x != 'setuptools' + ] + ) == sorted(setup_obj.install_requires) From aa077bc3f17d52cc5e49bc56eaf9d1da9c9dce70 Mon Sep 17 00:00:00 2001 From: Rachmadani Haryono Date: Sat, 21 Jan 2023 10:34:45 +0800 Subject: [PATCH 3/4] build(setup): fix flask-reverse-proxy --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e5094d1f..1aafca11 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ [ "flask-reverse-proxy-fix", "@", - "https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.2rc1.zip", + "https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.2.zip", ] ) install_requires = [ From c6515fdbb8f186b6366aa4777bcee1e01f9a7306 Mon Sep 17 00:00:00 2001 From: Rachmadani Haryono Date: Sat, 21 Jan 2023 10:43:28 +0800 Subject: [PATCH 4/4] build(setup): use 0.2.3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1aafca11..a74d50bb 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ [ "flask-reverse-proxy-fix", "@", - "https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.2.zip", + "https://github.com/rachmadaniHaryono/flask-reverse-proxy-fix/archive/refs/tags/v0.2.3.zip", ] ) install_requires = [