summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-11-23 10:32:31 (GMT)
committerGitHub <noreply@github.com>2021-11-23 10:32:31 (GMT)
commit327c764fa2a032e34dc268164c3c9c2f95b978c4 (patch)
tree4c080ec7067bdec381d4f79060298fc690b659e8 /Tools
parent99aad31b7ad493d4feea04064bcd6b04061477f9 (diff)
downloadcpython-327c764fa2a032e34dc268164c3c9c2f95b978c4.zip
cpython-327c764fa2a032e34dc268164c3c9c2f95b978c4.tar.gz
cpython-327c764fa2a032e34dc268164c3c9c2f95b978c4.tar.bz2
bpo-45561: Run smelly.py tool from $(srcdir) (GH-29138)
(cherry picked from commit 457e6a6e96b5afad403a0bc892508a77beef4d33) Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/smelly.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Tools/scripts/smelly.py b/Tools/scripts/smelly.py
index fb01660..276a5ab 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"):