Skip to content

Commit 3255521

Browse files
Martin Gansserhroncok
andcommitted
Fix wheel-based installations to include variety_build_settings
Fixes varietywalls#795 This could also move the cleanup to a custom cmdclass, but it is not necessary. Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
1 parent 877d04d commit 3255521

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

setup.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import os
2222
import sys
23+
from setuptools.command.build_py import build_py as _build_py
2324

2425
from variety_lib.varietyconfig import get_version
2526

@@ -41,14 +42,15 @@
4142
BUILD_SETTINGS_PATH = "variety_lib/variety_build_settings.py"
4243

4344

44-
class InstallWithDataDirectory(DistUtilsExtra.auto.install_auto):
45+
46+
class BuildWithDataDirectory(_build_py):
4547
def run(self):
46-
data_path = os.path.join(self.prefix, "share/variety/")
48+
data_path = os.path.join(sys.prefix, "share/variety/")
4749
with open(BUILD_SETTINGS_PATH, "w") as f:
4850
f.write("### Autogenerated by setup.py - do not edit!\n")
4951
f.write("__variety_data_directory__ = %r\n" % data_path)
50-
print("This build will look for Variety's data in %r." % data_path)
51-
DistUtilsExtra.auto.install_auto.run(self)
52+
print(f"[build_py] This build will look for Variety's data in {data_path!r}.")
53+
super().run()
5254

5355

5456
DistUtilsExtra.auto.setup(
@@ -69,7 +71,7 @@ def run(self):
6971
Variety also includes a range of image effects, such as oil painting and blur,
7072
as well as options to layer quotes and a clock onto the background.""",
7173
url="https://github.com/varietywalls/variety",
72-
cmdclass={"install": InstallWithDataDirectory},
74+
cmdclass={"build_py": BuildWithDataDirectory},
7375
data_files=[("share/metainfo", ["variety.appdata.xml"])],
7476
)
7577

0 commit comments

Comments
 (0)