Mailing List Archive

bpo-45561: Run smelly.py tool from $(srcdir) (GH-29138)
https://github.com/python/cpython/commit/457e6a6e96b5afad403a0bc892508a77beef4d33
commit: 457e6a6e96b5afad403a0bc892508a77beef4d33
branch: main
author: Neil Schemenauer <nas-github@arctrix.com>
committer: tiran <christian@python.org>
date: 2021-11-23T08:51:02+01:00
summary:

bpo-45561: Run smelly.py tool from $(srcdir) (GH-29138)

files:
A Misc/NEWS.d/next/Build/2021-10-21-14-38-30.bpo-45561.PVqhZE.rst
M Makefile.pre.in
M Tools/scripts/smelly.py

diff --git a/Makefile.pre.in b/Makefile.pre.in
index d52f73620795c..afa0414ce04cb 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2420,7 +2420,7 @@ distclean: clobber

# Check that all symbols exported by libpython start with "Py" or "_Py"
smelly: @DEF_MAKE_RULE@
- $(RUNSHARED) ./$(BUILDPYTHON) Tools/scripts/smelly.py
+ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/smelly.py

# Find files with funny names
funny:
diff --git a/Misc/NEWS.d/next/Build/2021-10-21-14-38-30.bpo-45561.PVqhZE.rst b/Misc/NEWS.d/next/Build/2021-10-21-14-38-30.bpo-45561.PVqhZE.rst
new file mode 100644
index 0000000000000..cf5d8686b9840
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2021-10-21-14-38-30.bpo-45561.PVqhZE.rst
@@ -0,0 +1 @@
+Run smelly.py tool from $(srcdir).
diff --git a/Tools/scripts/smelly.py b/Tools/scripts/smelly.py
index fb01660dea33a..276a5ab2cc84c 100755
--- a/Tools/scripts/smelly.py
+++ b/Tools/scripts/smelly.py
@@ -108,8 +108,11 @@ def check_library(library, dynamic=False):

def check_extensions():
print(__file__)
- srcdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
- filename = os.path.join(srcdir, "pybuilddir.txt")
+ # This assumes pybuilddir.txt is in same directory as pyconfig.h.
+ # In the case of out-of-tree builds, we can't assume pybuilddir.txt is
+ # in the source folder.
+ config_dir = os.path.dirname(sysconfig.get_config_h_filename())
+ filename = os.path.join(config_dir, "pybuilddir.txt")
try:
with open(filename, encoding="utf-8") as fp:
pybuilddir = fp.readline()
@@ -118,7 +121,7 @@ def check_extensions():
return True

print(f"Check extension modules from {pybuilddir} directory")
- builddir = os.path.join(srcdir, pybuilddir)
+ builddir = os.path.join(config_dir, pybuilddir)
nsymbol = 0
for name in os.listdir(builddir):
if not name.endswith(".so"):

_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins
bpo-45561: Run smelly.py tool from $(srcdir) (GH-29138) [ In reply to ]
https://github.com/python/cpython/commit/327c764fa2a032e34dc268164c3c9c2f95b978c4
commit: 327c764fa2a032e34dc268164c3c9c2f95b978c4
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
committer: miss-islington <31488909+miss-islington@users.noreply.github.com>
date: 2021-11-23T02:32:31-08:00
summary:

bpo-45561: Run smelly.py tool from $(srcdir) (GH-29138)

(cherry picked from commit 457e6a6e96b5afad403a0bc892508a77beef4d33)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>

files:
A Misc/NEWS.d/next/Build/2021-10-21-14-38-30.bpo-45561.PVqhZE.rst
M Makefile.pre.in
M Tools/scripts/smelly.py

diff --git a/Makefile.pre.in b/Makefile.pre.in
index ae6555c8e2fe1..86014227c3387 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1962,7 +1962,7 @@ distclean: clobber

# Check that all symbols exported by libpython start with "Py" or "_Py"
smelly: @DEF_MAKE_RULE@
- $(RUNSHARED) ./$(BUILDPYTHON) Tools/scripts/smelly.py
+ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/smelly.py

# Find files with funny names
funny:
diff --git a/Misc/NEWS.d/next/Build/2021-10-21-14-38-30.bpo-45561.PVqhZE.rst b/Misc/NEWS.d/next/Build/2021-10-21-14-38-30.bpo-45561.PVqhZE.rst
new file mode 100644
index 0000000000000..cf5d8686b9840
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2021-10-21-14-38-30.bpo-45561.PVqhZE.rst
@@ -0,0 +1 @@
+Run smelly.py tool from $(srcdir).
diff --git a/Tools/scripts/smelly.py b/Tools/scripts/smelly.py
index fb01660dea33a..276a5ab2cc84c 100755
--- a/Tools/scripts/smelly.py
+++ b/Tools/scripts/smelly.py
@@ -108,8 +108,11 @@ def check_library(library, dynamic=False):

def check_extensions():
print(__file__)
- srcdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
- filename = os.path.join(srcdir, "pybuilddir.txt")
+ # This assumes pybuilddir.txt is in same directory as pyconfig.h.
+ # In the case of out-of-tree builds, we can't assume pybuilddir.txt is
+ # in the source folder.
+ config_dir = os.path.dirname(sysconfig.get_config_h_filename())
+ filename = os.path.join(config_dir, "pybuilddir.txt")
try:
with open(filename, encoding="utf-8") as fp:
pybuilddir = fp.readline()
@@ -118,7 +121,7 @@ def check_extensions():
return True

print(f"Check extension modules from {pybuilddir} directory")
- builddir = os.path.join(srcdir, pybuilddir)
+ builddir = os.path.join(config_dir, pybuilddir)
nsymbol = 0
for name in os.listdir(builddir):
if not name.endswith(".so"):

_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins