misc (installation): --root option is ignored for _final destinations
This commit is contained in:
parent
06857823ff
commit
43dcdb6ba2
1 changed files with 12 additions and 3 deletions
15
setup.py
15
setup.py
|
|
@ -24,6 +24,7 @@ from setuptools.command.install import install
|
|||
from setuptools import setup
|
||||
from distutils.file_util import copy_file
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import subprocess
|
||||
from stat import ST_MODE
|
||||
|
|
@ -70,7 +71,7 @@ DBUS_FILE = 'misc/org.goffi.SAT.service'
|
|||
# to replace or a tuple with a template and values to replace (if value to replace is a string,
|
||||
# the attribute from self with that name will be used).
|
||||
FILE_ADJ = {'sh_script_path': {r'PYTHON *=.*': 'PYTHON="{}"'.format(sys.executable)},
|
||||
'dbus_service_path': {r'Exec *=.*': ('Exec={}', 'sh_script_path')},
|
||||
'dbus_service_path': {r'Exec *=.*': ('Exec={}', 'sh_script_path_final')},
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -123,14 +124,22 @@ class CustomInstall(install):
|
|||
if os.path.islink(dest) and os.readlink(dest) != source:
|
||||
os.remove(dest) # copy_file doesn't force the link update
|
||||
dest_name, copied = copy_file(source, dest, link='sym')
|
||||
assert (copied)
|
||||
assert copied
|
||||
# we change the perm in the same way as in the original install_scripts
|
||||
mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777
|
||||
os.chmod(dest_name, mode)
|
||||
|
||||
def run(self):
|
||||
ignore_idx = 0 if self.root is None else len(self.root)
|
||||
if self.root[-1] == '/':
|
||||
ignore_idx-=1 # we dont want to remove the first '/' in _final paths
|
||||
# _final suffixed attributes are the ones without the self.root prefix path
|
||||
# it's used at least on Arch linux installation as install is made on a local $pkgdir
|
||||
# which is later moved to user's FS root
|
||||
self.install_lib_final = self.install_lib[ignore_idx:]
|
||||
self.sh_script_path = os.path.join(self.install_lib, NAME, 'sat.sh')
|
||||
self.sh_script_links = [(self.sh_script_path, os.path.join(self.install_scripts, LAUNCH_DAEMON_COMMAND))]
|
||||
self.sh_script_path_final = os.path.join(self.install_lib_final, NAME, 'sat.sh')
|
||||
self.sh_script_links = [(self.sh_script_path_final, os.path.join(self.install_scripts, LAUNCH_DAEMON_COMMAND))]
|
||||
self.dbus_service_path = os.path.join(self.install_data, 'share', DBUS_DIR, os.path.basename(DBUS_FILE))
|
||||
sys.stdout.write('running pre installation stuff\n')
|
||||
sys.stdout.flush()
|
||||
|
|
|
|||
Loading…
Reference in a new issue