Add option to not compile gschemas to setup.py
This commit is contained in:
parent
fcdd8b1501
commit
6691959a85
1 changed files with 25 additions and 4 deletions
27
setup.py
27
setup.py
|
@ -7,16 +7,34 @@ import subprocess
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from setuptools.command.build_py import build_py
|
from setuptools.command.build_py import build_py
|
||||||
|
from setuptools.dist import Distribution
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MCGDistribution(Distribution):
|
||||||
|
global_options = Distribution.global_options + [
|
||||||
|
("no-compile-schemas", None, "Don't compile gsettings schemas")
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self.no_compile_schemas = False
|
||||||
|
super(self.__class__, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class build_mcg(build_py):
|
class build_mcg(build_py):
|
||||||
def run(self):
|
|
||||||
build_py.run(self)
|
|
||||||
|
def run(self, *args, **kwargs):
|
||||||
|
super(self.__class__, self).run(*args, **kwargs)
|
||||||
self._build_gresources()
|
self._build_gresources()
|
||||||
|
if not self.distribution.no_compile_schemas:
|
||||||
self._build_gschemas()
|
self._build_gschemas()
|
||||||
|
|
||||||
|
|
||||||
def _build_gresources(self):
|
def _build_gresources(self):
|
||||||
print("compiling gresources")
|
print("compiling gresources")
|
||||||
subprocess.run(['glib-compile-resources', 'de.coderkun.mcg.gresource.xml'], cwd='data')
|
subprocess.run(['glib-compile-resources', 'de.coderkun.mcg.gresource.xml'], cwd='data')
|
||||||
|
@ -30,7 +48,10 @@ class build_mcg(build_py):
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
cmdclass = {'build_py': build_mcg},
|
distclass = MCGDistribution,
|
||||||
|
cmdclass = {
|
||||||
|
'build_py': build_mcg
|
||||||
|
},
|
||||||
name = "CoverGrid",
|
name = "CoverGrid",
|
||||||
version = 0.6,
|
version = 0.6,
|
||||||
description = "CoverGrid is a client for the Music Player Daemon, focusing on albums instead of single tracks.",
|
description = "CoverGrid is a client for the Music Player Daemon, focusing on albums instead of single tracks.",
|
||||||
|
|
Loading…
Reference in a new issue