79631334

Date: 2025-05-21 00:22:43
Score: 0.5
Natty:
Report link

After some discussion on the Python discussion forum (and some help from a LLM) it was determined that overriding the build_py command instead of the install command would provide the desired result. The amended setup.py:

import subprocess
from setuptools import setup
from setuptools.command.build_py import build_py


class CustomBuild_Py(build_py):
    def run(self):
        with open("install.log", "w") as f:
            subprocess.run(["./compile.sh"], stdout=f)
        build_py.run(self)

setup(
    name="mypkg",
    packages=[“mypkg”],
    cmdclass={"build_py": CustomBuild_Py},
    include_package_data=True,
    zip_safe=False,
)
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: frank