def install(self): """Install library files after writing changes.""" get_command_obj = self.distribution.get_command_obj root = get_command_obj("install").root prefix = get_command_obj("install").install_data # Allow --root to be used like DESTDIR. if root is not None: prefix = os.path.abspath(prefix) prefix = prefix.replace(os.path.abspath(root), "") data_dir = os.path.join(prefix, "share", "nfoview") locale_dir = os.path.join(prefix, "share", "locale") # Write changes to the nfoview.paths module. path = os.path.join(self.build_dir, "nfoview", "paths.py") text = open(path, "r", encoding="utf_8").read() patt = 'DATA_DIR = get_data_directory_source()' repl = "DATA_DIR = {}".format(repr(data_dir)) text = text.replace(patt, repl) assert text.count(repr(data_dir)) > 0 patt = 'LOCALE_DIR = get_locale_directory_source()' repl = "LOCALE_DIR = {}".format(repr(locale_dir)) text = text.replace(patt, repl) assert text.count(repr(locale_dir)) > 0 open(path, "w", encoding="utf_8").write(text) return install_lib.install(self)
def install(self): """Install library files after writing changes.""" get_command_obj = self.distribution.get_command_obj root = get_command_obj("install").root prefix = get_command_obj("install").install_data # Allow --root to be used like DESTDIR. if root is not None: prefix = os.path.abspath(prefix) prefix = prefix.replace(os.path.abspath(root), "") data_dir = os.path.join(prefix, "share", "nfoview") locale_dir = os.path.join(prefix, "share", "locale") # Write changes to the nfoview.paths module. path = os.path.join(self.build_dir, "nfoview", "paths.py") text = open(path, "r", encoding="utf_8").read() patt = r"^DATA_DIR = .*$" repl = "DATA_DIR = {}".format(repr(data_dir)) text = re.sub(patt, repl, text, flags=re.MULTILINE) assert text.count(repl) == 1 patt = r"^LOCALE_DIR = .*$" repl = "LOCALE_DIR = {}".format(repr(locale_dir)) text = re.sub(patt, repl, text, flags=re.MULTILINE) assert text.count(repl) == 1 open(path, "w", encoding="utf_8").write(text) return install_lib.install(self)
def install(self): """Install library files after writing changes.""" if self.distribution.with_aeidon: self.__write_paths_module() return install_lib.install(self)