Add option to not compile gschemas to setup.py

This commit is contained in:
coderkun 2017-04-27 11:18:42 +02:00
parent fcdd8b1501
commit 6691959a85

View file

@ -7,15 +7,33 @@ 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()
self._build_gschemas() if not self.distribution.no_compile_schemas:
self._build_gschemas()
def _build_gresources(self): def _build_gresources(self):
print("compiling gresources") print("compiling gresources")
@ -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.",