mirror of
https://github.com/gryf/wicd.git
synced 2025-12-21 13:28:08 +01:00
Added custom install_script derived from setuptools.
This commit is contained in:
26
setup.py
26
setup.py
@@ -28,7 +28,9 @@ import subprocess
|
|||||||
from distutils import log
|
from distutils import log
|
||||||
from distutils.command import build as _build
|
from distutils.command import build as _build
|
||||||
|
|
||||||
|
import pkg_resources
|
||||||
import setuptools
|
import setuptools
|
||||||
|
from setuptools.command import install_scripts as _install_scripts
|
||||||
from setuptools.command import install as _install
|
from setuptools.command import install as _install
|
||||||
|
|
||||||
import wicd
|
import wicd
|
||||||
@@ -324,6 +326,28 @@ class configure(setuptools.Command):
|
|||||||
pass
|
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):
|
class clear_generated(setuptools.Command):
|
||||||
description = 'clears out files generated by configure'
|
description = 'clears out files generated by configure'
|
||||||
|
|
||||||
@@ -599,7 +623,7 @@ class uninstall(setuptools.Command):
|
|||||||
setuptools.setup(cmdclass={'build': build,
|
setuptools.setup(cmdclass={'build': build,
|
||||||
'configure': configure,
|
'configure': configure,
|
||||||
'install': install,
|
'install': install,
|
||||||
'uninstall': uninstall,
|
'install_scripts': install_scripts,
|
||||||
'test': test,
|
'test': test,
|
||||||
'clear_generated': clear_generated,
|
'clear_generated': clear_generated,
|
||||||
'update_message_catalog': update_message_catalog,
|
'update_message_catalog': update_message_catalog,
|
||||||
|
|||||||
Reference in New Issue
Block a user