Do not run custom build commands on other packages

This commit is contained in:
Raphael Michel
2023-06-12 09:34:56 +02:00
parent cfe0f67f0d
commit 943aeaa31f
2 changed files with 8 additions and 1 deletions

View File

@@ -29,7 +29,6 @@ sys.path.append(str(Path.cwd() / 'src'))
def _CustomBuild(*args, **kwargs):
print(sys.path)
from pretix._build import CustomBuild
return CustomBuild(*args, **kwargs)

View File

@@ -45,6 +45,10 @@ def npm_install():
class CustomBuild(build):
def run(self):
if "pretix" not in os.listdir("."):
# Only run this command on the pretix module, not on other modules even if it's registered globally
# in some cases
return build.run(self)
if "PRETIX_DOCKER_BUILD" in os.environ:
return # this is a hack to allow calling this file early in our docker build to make use of caching
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pretix._build_settings")
@@ -68,6 +72,10 @@ class CustomBuild(build):
class CustomBuildExt(build_ext):
def run(self):
if "pretix" not in os.listdir("."):
# Only run this command on the pretix module, not on other modules even if it's registered globally
# in some cases
return build_ext.run(self)
if "PRETIX_DOCKER_BUILD" in os.environ:
return # this is a hack to allow calling this file early in our docker build to make use of caching
npm_install()