From nobody Sun Oct 24 10:55:34 2021 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D7B29180FC9D; Sun, 24 Oct 2021 10:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HcZkG5l5nz3JCF; Sun, 24 Oct 2021 10:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4E621425F; Sun, 24 Oct 2021 10:55:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19OAtY36042026; Sun, 24 Oct 2021 10:55:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19OAtYr4042025; Sun, 24 Oct 2021 10:55:34 GMT (envelope-from git) Date: Sun, 24 Oct 2021 10:55:34 GMT Message-Id: <202110241055.19OAtYr4042025@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Kai Knoblich Subject: git: adc0cc3f69ae - main - devel/py-setuptools_scm: Do not run "git archive" on Ports tree List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kai X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: adc0cc3f69aeac37b9678c6d5b4d548d9c60cfae Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kai: URL: https://cgit.FreeBSD.org/ports/commit/?id=adc0cc3f69aeac37b9678c6d5b4d548d9c60cfae commit adc0cc3f69aeac37b9678c6d5b4d548d9c60cfae Author: Kai Knoblich AuthorDate: 2021-10-24 10:43:33 +0000 Commit: Kai Knoblich CommitDate: 2021-10-24 10:54:58 +0000 devel/py-setuptools_scm: Do not run "git archive" on Ports tree * In build environments have git installed in conjunction with a git-based Ports tree and haven't WRKDIRPREFIX set, there will be significant delays when building devel/py-setuptools_scm or ports that depend on it. This is because the top-level directory of the git repository is determined during build via "git rev-parse --show-toplevel" which is issued inside the WRKSRC directory. Once the top-level directory (which is PORTSDIR) has been determined, an archive is created from this point using "git archive" which is then very time-consuming due the complexity of the Ports tree. In environments (e.g. poudriere) that have WRKDIRPREFIX set and also have git present during build, the issue doesn't appear because "git rev-parse --show-toplevel" fails silently with "not a git repo". Remedy the issue by returning only the actual path of WRKSRC, but only if it has "setup.py" in it (= devel/py-setuptools_scm is built) or a test session is performed. * Modernize the "do-test" target while I'm here and bump PORTREVISION due package change. PR: 258891 Reported by: Robert Clausecker Obtained from: OpenIndiana MFH: 2021Q4 (after 1 week) --- devel/py-setuptools_scm/Makefile | 8 ++++++-- .../patch-src_setuptools__scm_file__finder__git.py | 22 ++++++++++++++++++++++ .../patch-src_setuptools__scm_file__finder__hg.py | 22 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/devel/py-setuptools_scm/Makefile b/devel/py-setuptools_scm/Makefile index 6d5f80cc6d07..c3a15793cfb0 100644 --- a/devel/py-setuptools_scm/Makefile +++ b/devel/py-setuptools_scm/Makefile @@ -1,6 +1,6 @@ PORTNAME= setuptools_scm PORTVERSION= 4.1.2 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= devel python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -19,6 +19,10 @@ TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \ USES= python:3.6+ USE_PYTHON= autoplist distutils +# Workaround to get a 100% working test suite. This can be removed once +# https://github.com/pypa/setuptools_scm/issues/353 is solved. +TEST_ENV= _PYTEST_SESSION=yes + NO_ARCH= yes OPTIONS_DEFINE= TOML @@ -28,6 +32,6 @@ TOML_DESC= Support for parsing pyproject.toml files [PEP 517/518] TOML_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}toml>0:textproc/py-toml@${PY_FLAVOR} do-test: - @cd ${WRKSRC} && ${PYTHON_CMD} -m pytest -v -rs + @cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest -v -rs .include diff --git a/devel/py-setuptools_scm/files/patch-src_setuptools__scm_file__finder__git.py b/devel/py-setuptools_scm/files/patch-src_setuptools__scm_file__finder__git.py new file mode 100644 index 000000000000..d33a125106b5 --- /dev/null +++ b/devel/py-setuptools_scm/files/patch-src_setuptools__scm_file__finder__git.py @@ -0,0 +1,22 @@ +Workaround for https://github.com/pypa/setuptools_scm/issues/353 + +Original version (without the check for test sessions) obtained from: + +https://github.com/OpenIndiana/oi-userland/commit/7d928fa26c0c5e4c29b4826fe78dc42401730529 + +--- src/setuptools_scm/file_finder_git.py.orig 2021-10-20 09:27:26 UTC ++++ src/setuptools_scm/file_finder_git.py +@@ -18,7 +18,12 @@ def _git_toplevel(path): + stderr=devnull, + ) + trace("find files toplevel", out) +- return os.path.normcase(os.path.realpath(out.strip())) ++ toplevel_path = os.path.normcase(os.path.realpath(out.strip())) ++ setup_py_path = os.path.join(toplevel_path, "setup.py") ++ if os.path.exists(setup_py_path) or os.environ.get("_PYTEST_SESSION"): ++ return toplevel_path ++ else: ++ return None + except subprocess.CalledProcessError: + # git returned error, we are not in a git repo + return None diff --git a/devel/py-setuptools_scm/files/patch-src_setuptools__scm_file__finder__hg.py b/devel/py-setuptools_scm/files/patch-src_setuptools__scm_file__finder__hg.py new file mode 100644 index 000000000000..7da5458d484a --- /dev/null +++ b/devel/py-setuptools_scm/files/patch-src_setuptools__scm_file__finder__hg.py @@ -0,0 +1,22 @@ +Workaround for https://github.com/pypa/setuptools_scm/issues/353 + +Original version (without the check for test sessions) obtained from: + +https://github.com/OpenIndiana/oi-userland/commit/7d928fa26c0c5e4c29b4826fe78dc42401730529 + +--- src/setuptools_scm/file_finder_hg.py.orig 2021-10-20 09:29:52 UTC ++++ src/setuptools_scm/file_finder_hg.py +@@ -13,7 +13,12 @@ def _hg_toplevel(path): + universal_newlines=True, + stderr=devnull, + ) +- return os.path.normcase(os.path.realpath(out.strip())) ++ toplevel_path = os.path.normcase(os.path.realpath(out.strip())) ++ setup_py_path = os.path.join(toplevel_path, "setup.py") ++ if os.path.exists(setup_py_path) or os.environ.get("_PYTEST_SESSION"): ++ return toplevel_path ++ else: ++ return None + except subprocess.CalledProcessError: + # hg returned error, we are not in a mercurial repo + return None