Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Run smelly.py tool from $(srcdir).
9 changes: 6 additions & 3 deletions Tools/scripts/smelly.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"):
Expand Down