Commit e82594a8 authored by Kai Willadsen's avatar Kai Willadsen

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 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.
parent 32c6d699
......@@ -23,11 +23,13 @@ from __future__ import print_function
import distutils.cmd
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'
class install_data(distutils.command.install_data.install_data):
def run(self):
......@@ -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')):
......@@ -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,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment