Reputation: 15110
I have a repo that I'm trying to modify to be deployable as a python package.
Unfortunately, the root of the repository has a file named BUILD
that cannot be changed due to existing CI integrations. As a result, when I attempt to pip install
or python setup.py bdist_wheel
or any other permutation of using setuptools
it fails because it cannot create a build/
directory.
How can I change that build directory to be _build/
or something non-conflicting?
I've tried several things like python setup.py build -b _build
which works for the build step in isolation, but I can't find an equivalent command line argument or setup.py
option that will let me change it for all of the subcommands of bdist_wheel
. There seem to be a lot of moving pieces that expect to be able to create a build
directory at some point or reference it, and I haven't been able to track them all down.
Upvotes: 4
Views: 3992
Reputation: 94483
Override build_base
in build
command; it's used in all other distutils/setuptools commands:
import distutils.command.build
# Override build command
class BuildCommand(distutils.command.build.build):
def initialize_options(self):
distutils.command.build.build.initialize_options(self)
self.build_base = 'my-special-build-dir'
setup(
…
cmdclass={"build": BuildCommand},
…
)
Upvotes: 4