mirror of
https://github.com/gryf/wicd.git
synced 2026-02-02 14:15:47 +01:00
Removed bin/sbin out of config options.
Let's do this in pythonic way, optionally leave the decision to package maintainers, where to put binaries.
This commit is contained in:
75
setup.py
75
setup.py
@@ -28,9 +28,7 @@ import subprocess
|
||||
from distutils import log
|
||||
from distutils.command import build as _build
|
||||
|
||||
import pkg_resources
|
||||
import setuptools
|
||||
from setuptools.command import install_scripts as _install_scripts
|
||||
from setuptools.command import install as _install
|
||||
|
||||
import wicd
|
||||
@@ -71,29 +69,29 @@ empty_file = 'other/.empty_on_purpose'
|
||||
# change to the directory setup.py is contained in
|
||||
os.chdir(os.path.abspath(os.path.split(__file__)[0]))
|
||||
|
||||
BUILD_OPTS = {'bin': '/usr/bin/',
|
||||
'dbus': '/etc/dbus-1/system.d/',
|
||||
BUILD_OPTS = {'dbus': '/etc/dbus-1/system.d/',
|
||||
'dbus_service': '/usr/share/dbus-1/system-services/',
|
||||
'distro': None,
|
||||
'docdir': '/usr/share/doc/wicd/',
|
||||
'logrotate': '/etc/logrotate.d/',
|
||||
'mandir': '/usr/share/man/',
|
||||
'scripts': '/etc/wicd/scripts/',
|
||||
'systemd': '/lib/systemd/system/',
|
||||
'resume': '/etc/acpi/resume.d/',
|
||||
'suspend': '/etc/acpi/suspend.d/',
|
||||
'pmutils': '/usr/lib/pm-utils/sleep.d/',
|
||||
'no_install_init': False,
|
||||
'no_install_man': False,
|
||||
'no_install_i18n': False,
|
||||
'no_install_i18n_man': False,
|
||||
'no_install_acpi': False,
|
||||
'no_install_pmutils': False,
|
||||
'no_install_docs': False,
|
||||
'distro_detect_failed': False,
|
||||
'docdir': '/usr/share/doc/wicd/',
|
||||
'init': '',
|
||||
'initfile': '',
|
||||
'initfilename': ''}
|
||||
'initfilename': '',
|
||||
'logrotate': '/etc/logrotate.d/',
|
||||
'mandir': '/usr/share/man/',
|
||||
'no_install_acpi': False,
|
||||
'no_install_docs': False,
|
||||
'no_install_i18n': False,
|
||||
'no_install_i18n_man': False,
|
||||
'no_install_init': False,
|
||||
'no_install_man': False,
|
||||
'no_install_pmutils': False,
|
||||
'pmutils': '/usr/lib/pm-utils/sleep.d/',
|
||||
'resume': '/etc/acpi/resume.d/',
|
||||
'scripts': '/etc/wicd/scripts/',
|
||||
'suspend': '/etc/acpi/suspend.d/',
|
||||
'systemd': '/lib/systemd/system/',
|
||||
'translations': '/usr/share/locale'}
|
||||
|
||||
|
||||
class build(_build.build):
|
||||
@@ -110,8 +108,6 @@ class configure(setuptools.Command):
|
||||
|
||||
user_options = [
|
||||
('encryption=', None, 'set the encryption template directory'),
|
||||
('bin=', None, 'set the bin directory'),
|
||||
('sbin=', None, 'set the sbin directory'),
|
||||
('networks=', None, 'set the encryption configuration directory'),
|
||||
('log=', None, 'set the log directory'),
|
||||
('resume=', None, 'set the directory the resume from suspend script '
|
||||
@@ -319,28 +315,6 @@ class configure(setuptools.Command):
|
||||
pass
|
||||
|
||||
|
||||
class install_scripts(_install_scripts.install_scripts):
|
||||
def write_script(self, script_name, contents, mode="t", *ignored):
|
||||
"""Write an executable file to the scripts directory"""
|
||||
from setuptools.command.easy_install import chmod, current_umask
|
||||
|
||||
log.info("Installing %s script to %s", script_name, self.install_dir)
|
||||
install_dir = self.install_dir
|
||||
if script_name == 'wicd':
|
||||
install_dir = os.path.join(
|
||||
self.install_dir[:self.install_dir.rfind('bin')], 'sbin')
|
||||
target = os.path.join(install_dir, script_name)
|
||||
self.outfiles.append(target)
|
||||
|
||||
mask = current_umask()
|
||||
if not self.dry_run:
|
||||
pkg_resources.ensure_directory(target)
|
||||
f = open(target, "w" + mode)
|
||||
f.write(contents)
|
||||
f.close()
|
||||
chmod(target, 0o777 - mask)
|
||||
|
||||
|
||||
class clear_generated(setuptools.Command):
|
||||
description = 'clears out files generated by configure'
|
||||
|
||||
@@ -386,6 +360,9 @@ class install(_install.install):
|
||||
(wpath.preconnectscripts, [empty_file]),
|
||||
(wpath.postconnectscripts, [empty_file])])
|
||||
|
||||
if os.path.exists('data/etc/wicd.conf'):
|
||||
data.append((wpath.etc, ['data/etc/wicd.conf']))
|
||||
|
||||
if not wpath.no_install_docs:
|
||||
data.append((wpath.docdir, ['AUTHORS', 'CHANGES', 'INSTALL',
|
||||
'LICENSE', 'README.cli',
|
||||
@@ -427,15 +404,16 @@ class install(_install.install):
|
||||
log.info('Using pid path %s', os.path.basename(wpath.pidfile))
|
||||
|
||||
if not wpath.no_install_i18n:
|
||||
for language in sorted(glob('translations/*')):
|
||||
language = language.replace('translations/', '')
|
||||
for language in sorted(os.listdir('translations')):
|
||||
log.info('Language support for %s', language)
|
||||
data.append((os.path.join(wpath.translations, language,
|
||||
'/LC_MESSAGES/'),
|
||||
[os.path.join('translations/', language,
|
||||
'LC_MESSAGES'),
|
||||
[os.path.join('translations', language,
|
||||
'LC_MESSAGES', 'wicd.mo')]))
|
||||
|
||||
for dir_ in (os.listdir('data')):
|
||||
if dir_ == 'init':
|
||||
continue
|
||||
path = os.path.join('data', dir_)
|
||||
for fname in os.listdir(path):
|
||||
data.append((wpath[dir_], [os.path.join(path, fname)]))
|
||||
@@ -584,7 +562,6 @@ class uninstall(setuptools.Command):
|
||||
setuptools.setup(cmdclass={'build': build,
|
||||
'configure': configure,
|
||||
'install': install,
|
||||
'install_scripts': install_scripts,
|
||||
'test': test,
|
||||
'clear_generated': clear_generated,
|
||||
'update_message_catalog': update_message_catalog,
|
||||
|
||||
Reference in New Issue
Block a user