aboutsummaryrefslogtreecommitdiff
path: root/setup_extensions.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup_extensions.py')
-rw-r--r--setup_extensions.py130
1 files changed, 65 insertions, 65 deletions
diff --git a/setup_extensions.py b/setup_extensions.py
index 12b123aa..7294f317 100644
--- a/setup_extensions.py
+++ b/setup_extensions.py
@@ -16,79 +16,79 @@ from stat import S_IMODE
import os
class build_scripts(_build_scripts):
- """
- Hacked version of distutils.build_scripts, designed to support
- multiple target installation directories like install_data does.
+ """
+ Hacked version of distutils.build_scripts, designed to support
+ multiple target installation directories like install_data does.
- [(target_directory, [list_of_source_scripts]), ...]
+ [(target_directory, [list_of_source_scripts]), ...]
- Most of the real work is in the companion hacked install_scripts,
- but we need to tweak the list of source files that build_scripts
- pulls out of the Distribution object.
- """
+ Most of the real work is in the companion hacked install_scripts,
+ but we need to tweak the list of source files that build_scripts
+ pulls out of the Distribution object.
+ """
- def finalize_options(self):
- _build_scripts.finalize_options(self)
- self.scripts = []
- for script in self.distribution.scripts:
- if isinstance(script, str):
- self.scripts.append(script)
- else:
- self.scripts.extend(script[1])
+ def finalize_options(self):
+ _build_scripts.finalize_options(self)
+ self.scripts = []
+ for script in self.distribution.scripts:
+ if isinstance(script, str):
+ self.scripts.append(script)
+ else:
+ self.scripts.extend(script[1])
class install_scripts(_install_scripts):
- """
- Hacked version of distutils.install_scripts, designed to support
- multiple target installation directories like install_data does.
+ """
+ Hacked version of distutils.install_scripts, designed to support
+ multiple target installation directories like install_data does.
- [(target_directory, [list_of_source_scripts]), ...]
+ [(target_directory, [list_of_source_scripts]), ...]
- The code here is a tweaked combination of what the stock
- install_scripts and install_data classes do.
- """
+ The code here is a tweaked combination of what the stock
+ install_scripts and install_data classes do.
+ """
- user_options = _install_scripts.user_options + [
- ("root=", None, "install everything relative to this alternate root directory")]
+ user_options = _install_scripts.user_options + [
+ ("root=", None, "install everything relative to this alternate root directory")]
- def initialize_options(self):
- _install_scripts.initialize_options(self)
- self.outfiles = []
- self.root = None
+ def initialize_options(self):
+ _install_scripts.initialize_options(self)
+ self.outfiles = []
+ self.root = None
- def finalize_options (self):
- self.set_undefined_options("build",
- ("build_scripts", "build_dir"))
- self.set_undefined_options("install",
- ("install_scripts", "install_dir"),
- ("root", "root"),
- ("force", "force"),
- ("skip_build", "skip_build"))
+ def finalize_options (self):
+ self.set_undefined_options("build",
+ ("build_scripts", "build_dir"))
+ self.set_undefined_options("install",
+ ("install_scripts", "install_dir"),
+ ("root", "root"),
+ ("force", "force"),
+ ("skip_build", "skip_build"))
- def run(self):
- if not self.skip_build:
- self.run_command("build_scripts")
- for script in self.distribution.scripts:
- if isinstance(script, str):
- fn = os.path.join(self.build_dir, os.path.basename(convert_path(script)))
- out, _ = self.copy_file(fn, self.install_dir)
- self.outfiles.append(out)
- else:
- dn = convert_path(script[0])
- if not os.path.isabs(dn):
- dn = os.path.join(self.install_dir, dn)
- elif self.root:
- dn = change_root(self.root, dn)
- self.mkpath(dn)
- if not script[1]:
- self.outfiles.append(dn)
- else:
- for s in script[1]:
- fn = os.path.join(self.build_dir, os.path.basename(convert_path(s)))
- out, _ = self.copy_file(fn, dn)
- self.outfiles.append(out)
- if os.name == "posix":
- for fn in self.get_outputs():
- mode = S_IMODE(os.stat(fn).st_mode) | 0555
- log.info("changing mode of %s to %o", fn, mode)
- if not self.dry_run:
- os.chmod(fn, mode)
+ def run(self):
+ if not self.skip_build:
+ self.run_command("build_scripts")
+ for script in self.distribution.scripts:
+ if isinstance(script, str):
+ fn = os.path.join(self.build_dir, os.path.basename(convert_path(script)))
+ out, _ = self.copy_file(fn, self.install_dir)
+ self.outfiles.append(out)
+ else:
+ dn = convert_path(script[0])
+ if not os.path.isabs(dn):
+ dn = os.path.join(self.install_dir, dn)
+ elif self.root:
+ dn = change_root(self.root, dn)
+ self.mkpath(dn)
+ if not script[1]:
+ self.outfiles.append(dn)
+ else:
+ for s in script[1]:
+ fn = os.path.join(self.build_dir, os.path.basename(convert_path(s)))
+ out, _ = self.copy_file(fn, dn)
+ self.outfiles.append(out)
+ if os.name == "posix":
+ for fn in self.get_outputs():
+ mode = S_IMODE(os.stat(fn).st_mode) | 0555
+ log.info("changing mode of %s to %o", fn, mode)
+ if not self.dry_run:
+ os.chmod(fn, mode)