[meld] build_helpers: Override install command to fix install layout issues
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] build_helpers: Override install command to fix install layout issues
- Date: Tue, 9 Sep 2014 21:21:38 +0000 (UTC)
commit e82594a876811dada161aa3cf2dd72a0cb7f9f06
Author: Kai Willadsen <kai willadsen gmail com>
Date: Wed Sep 10 07:17:58 2014 +1000
build_helpers: Override install command to fix install layout issues
Debian and Ubuntu need --install-layout=deb to be enabled by default
for sane user behaviour, but that flag doesn't work for non-install
commands, breaking `python setup.py build`.
This commit stops hard-adding the layout argument to sys.argv for
Debian and Ubuntu in favour of defaulting the argument to the deb
layout if it's not otherwise specified, and only doing so on install.
meld/build_helpers.py | 15 +++++++++++++++
setup.py | 7 +------
2 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/meld/build_helpers.py b/meld/build_helpers.py
index 7eb2fd1..385e3dc 100644
--- a/meld/build_helpers.py
+++ b/meld/build_helpers.py
@@ -23,11 +23,13 @@ from __future__ import print_function
import distutils.cmd
import distutils.command.build
import distutils.command.build_py
+import distutils.command.install
import distutils.command.install_data
import distutils.dist
import distutils.dir_util
import glob
import os.path
+import platform
import sys
from distutils.log import info
@@ -360,6 +362,19 @@ class build_py(distutils.command.build_py.build_py):
self, module, module_file, package)
+class install(distutils.command.install.install):
+
+ def finalize_options(self):
+ special_cases = ('debian', 'ubuntu')
+ if (platform.system() == 'Linux' and
+ platform.linux_distribution()[0].lower() in special_cases):
+ # Maintain an explicit install-layout, but use deb by default
+ specified_layout = getattr(self, 'install_layout', None)
+ self.install_layout = specified_layout or 'deb'
+
+ distutils.command.install.install.finalize_options(self)
+
+
class install_data(distutils.command.install_data.install_data):
def run(self):
diff --git a/setup.py b/setup.py
index e1840af..8f3c333 100644
--- a/setup.py
+++ b/setup.py
@@ -2,17 +2,11 @@
from distutils.core import setup
import glob
-import platform
-import sys
import meld.build_helpers
import meld.conf
-if (platform.system() == 'Linux' and
- platform.linux_distribution()[0].lower() in ('debian', 'ubuntu')):
- sys.argv.append('--install-layout=deb')
-
setup(
name=meld.conf.__package__,
version=meld.conf.__version__,
@@ -66,6 +60,7 @@ setup(
"build_icons": meld.build_helpers.build_icons,
"build_data": meld.build_helpers.build_data,
"build_py": meld.build_helpers.build_py,
+ "install": meld.build_helpers.install,
"install_data": meld.build_helpers.install_data,
},
distclass=meld.build_helpers.MeldDistribution,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]