From 2941253f3121fa95c623f74d633c7a03f369b03b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Sep 2009 17:42:18 -0600 Subject: [PATCH] IGN: Change the way the --root option to the install command works. Now it only affects where files are installed, but not the paths written into the launcher scripts --- setup/install.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/setup/install.py b/setup/install.py index c321c94e57..d30adfeb96 100644 --- a/setup/install.py +++ b/setup/install.py @@ -43,8 +43,9 @@ class Develop(Command): sub_commands = ['build', 'resources', 'gui'] def add_options(self, parser): - parser.add_option('--prefix', '--root', - help='Binaries will be installed in /bin') + parser.add_option('--prefix', + help='Binaries will be installed in /bin') + self.root = '' def pre_sub_commands(self, opts): if not islinux: @@ -76,7 +77,7 @@ class Develop(Command): return warn() import stat src = os.path.join(self.SRC, 'calibre', 'devices', 'linux_mount_helper.c') - dest = os.path.join(self.bindir, 'calibre-mount-helper') + dest = self.root + os.path.join(self.bindir, 'calibre-mount-helper') self.info('Installing mount helper to '+ dest) p = subprocess.Popen(['gcc', '-Wall', src, '-o', dest]) ret = p.wait() @@ -120,7 +121,7 @@ class Develop(Command): module=mod, func=func, path=self.path, resources=self.resources, extensions=self.extensions) - path = self.j(self.bindir, name) + path = self.root + self.j(self.bindir, name) if not os.path.exists(self.bindir): os.makedirs(self.bindir) self.info('Installing binary:', path) @@ -141,10 +142,13 @@ class Install(Develop): sub_commands = ['build', 'gui'] def add_options(self, parser): - parser.add_option('--prefix', '--root', help='Installation prefix') + parser.add_option('--prefix', help='Installation prefix') parser.add_option('--libdir', help='Where to put calibre library files') parser.add_option('--bindir', help='Where to install calibre binaries') parser.add_option('--sharedir', help='Where to install calibre data files') + parser.add_option('--root', default='', + help='Use a different installation root (mainly for packaging)') + self.root = '' def find_locations(self, opts): if opts.prefix is None: @@ -160,9 +164,10 @@ class Install(Develop): self.path = opts.libdir self.resources = opts.sharedir self.extensions = self.j(self.path, 'calibre', 'plugins') + self.root = opts.root def install_files(self, opts): - dest = self.path + dest = self.root + self.path if os.path.exists(dest): shutil.rmtree(dest) shutil.copytree(self.SRC, dest) @@ -171,7 +176,7 @@ class Install(Develop): x = self.j(dest, x) if os.path.exists(dest): shutil.rmtree(x) - dest = self.resources + dest = self.root + self.resources if os.path.exists(dest): shutil.rmtree(dest) shutil.copytree(self.RESOURCES, dest)