2020
2121import os
2222import sys
23+ from setuptools .command .build_py import build_py as _build_py
2324
2425from variety_lib .varietyconfig import get_version
2526
4142BUILD_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
5456DistUtilsExtra .auto .setup (
@@ -69,7 +71,7 @@ def run(self):
6971Variety also includes a range of image effects, such as oil painting and blur,
7072as 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