From 739c6587d68126056104bd260a69626bf6680d12 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Fri, 11 Oct 2024 00:45:25 -0400 Subject: [PATCH] fix: Run clean separately, due to package cache in Setuptools. Add pip requirement for uberegg. --- CHANGES.rst | 6 ++++-- pyproject.toml | 3 ++- scrapyd_client/deploy.py | 3 ++- tests/test_scrapyd_deploy.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 5801b99..06f12d1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,13 +12,15 @@ Added Changed ^^^^^^^ -- The ``scrapyd-deploy --debug`` option prints the subprocess' standard output and standard error, instead of writing to ``stdout`` and ``stderr`` files. +- The ``scrapyd-client schedule`` subcommand accepts multiple ``--arg setting=...`` arguments. (@mxdev88) - The ``scrapyd_client.lib.schedule`` and ``scrapyd_client.ScrapyClient.schedule`` methods accept ``args`` as a list, instead of as a dict. +- The ``scrapyd-deploy --debug`` option prints the subprocess' standard output and standard error, instead of writing to ``stdout`` and ``stderr`` files. Fixed ^^^^^ -- The ``scrapyd-client schedule`` subcommand accepts multiple ``--arg setting=...`` arguments. (@mxdev88) +- Run ``clean`` separately from building the egg. (Setuptools caches the Python packages from before ``clean`` runs.) +- Add ``pip`` requirement for ``uberegg``. Removed ^^^^^^^ diff --git a/pyproject.toml b/pyproject.toml index d263aec..7ade097 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [ + "pip", # uberegg "requests", "scrapy>=0.17", "setuptools", @@ -34,9 +35,9 @@ dependencies = [ [project.optional-dependencies] test = [ + "coverage", "pytest", "pytest-console-scripts", - "pytest-cov", "pytest-mock", ] diff --git a/scrapyd_client/deploy.py b/scrapyd_client/deploy.py index 8780725..596e530 100644 --- a/scrapyd_client/deploy.py +++ b/scrapyd_client/deploy.py @@ -251,7 +251,8 @@ def _build_egg(opts): command = "bdist_egg" kwargs = {} if opts.debug else {"stdout": subprocess.DEVNULL, "stderr": subprocess.DEVNULL} - subprocess.run([sys.executable, "setup.py", "clean", "-a", command, "-d", tmpdir], check=True, **kwargs) + subprocess.run([sys.executable, "setup.py", "clean", "-a"], check=True, **kwargs) + subprocess.run([sys.executable, "setup.py", command, "-d", tmpdir], check=True, **kwargs) eggpath = glob.glob(os.path.join(tmpdir, "*.egg"))[0] return eggpath, tmpdir diff --git a/tests/test_scrapyd_deploy.py b/tests/test_scrapyd_deploy.py index 2341268..75fb26c 100644 --- a/tests/test_scrapyd_deploy.py +++ b/tests/test_scrapyd_deploy.py @@ -288,7 +288,7 @@ def test_build_egg_inc_dependencies_no_dep(script_runner, project): def test_build_egg_inc_dependencies_with_dep(script_runner, project_with_dependencies): - ret = script_runner.run(["scrapyd-deploy", "--include-dependencies", "--build-egg", "myegg-deps.egg"]) + ret = script_runner.run(["scrapyd-deploy", "--include-dependencies", "--build-egg", "myegg-deps.egg", "--debug"]) assert ret.stdout == "" assert_lines(