def build_wheel(self, wheel_directory, config_settings=None, metadata_directory=None): config_settings = self._fix_config(config_settings) wheel_directory = os.path.abspath(wheel_directory) # Build the wheel in a temporary directory, then copy to the target with TemporaryDirectory(dir=wheel_directory) as tmp_dist_dir: sys.argv = (sys.argv[:1] + ['bdist_wheel', '--dist-dir', tmp_dist_dir] + config_settings["--global-option"]) self.run_setup() wheel_basename = _file_with_extension(tmp_dist_dir, '.whl') wheel_path = os.path.join(wheel_directory, wheel_basename) if os.path.exists(wheel_path): # os.rename will fail overwriting on non-unix env os.remove(wheel_path) os.rename(os.path.join(tmp_dist_dir, wheel_basename), wheel_path) return wheel_basename
def _build_with_temp_dir(self, setup_command, result_extension, result_directory, config_settings): config_settings = self._fix_config(config_settings) result_directory = os.path.abspath(result_directory) # Build in a temporary directory, then copy to the target. os.makedirs(result_directory, exist_ok=True) with TemporaryDirectory(dir=result_directory) as tmp_dist_dir: sys.argv = (sys.argv[:1] + setup_command + ['--dist-dir', tmp_dist_dir] + config_settings["--global-option"]) self.run_setup() result_basename = _file_with_extension( tmp_dist_dir, result_extension) result_path = os.path.join(result_directory, result_basename) if os.path.exists(result_path): # os.rename will fail overwriting on non-Unix. os.remove(result_path) os.rename(os.path.join(tmp_dist_dir, result_basename), result_path) return result_basename
def load(cls, dirname=''): normdir = os.path.normpath(dirname) # Temp config directory should be enough to check for repository # This is needed because .svn always creates .subversion and # some operating systems do not handle dot directory correctly. # Real queries in real svn repos with be concerned with it creation with TemporaryDirectory() as tempdir: code, data = _run_command(['svn', '--config-dir', tempdir, 'info', normdir]) # Must check for some contents, as some use empty directories # in testcases, however only enteries is needed also the info # command above MUST have worked svn_dir = os.path.join(normdir, '.svn') is_svn_wd = (not code or os.path.isfile(os.path.join(svn_dir, 'entries'))) svn_version = tuple(cls.get_svn_version().split('.')) try: base_svn_version = tuple(int(x) for x in svn_version[:2]) except ValueError: base_svn_version = tuple() if not is_svn_wd: #return an instance of this NO-OP class return SvnInfo(dirname) if code or not base_svn_version or base_svn_version < (1, 3): warnings.warn(("No SVN 1.3+ command found: falling back " "on pre 1.7 .svn parsing"), DeprecationWarning) return SvnFileInfo(dirname) if base_svn_version < (1, 5): return Svn13Info(dirname) return Svn15Info(dirname)
def _build_with_temp_dir(self, setup_command, result_extension, result_directory, config_settings): config_settings = self._fix_config(config_settings) result_directory = os.path.abspath(result_directory) # Build in a temporary directory, then copy to the target. os.makedirs(result_directory, exist_ok=True) <<<<<<< HEAD with tempfile.TemporaryDirectory(dir=result_directory) as tmp_dist_dir: sys.argv = (sys.argv[:1] + setup_command + ['--dist-dir', tmp_dist_dir] + config_settings["--global-option"]) with no_install_setup_requires(): self.run_setup() ======= with TemporaryDirectory(dir=result_directory) as tmp_dist_dir: sys.argv = (sys.argv[:1] + setup_command + ['--dist-dir', tmp_dist_dir] + config_settings["--global-option"]) self.run_setup() >>>>>>> 74c061954d5e927be4caafbd793e96a50563c265 result_basename = _file_with_extension( tmp_dist_dir, result_extension) result_path = os.path.join(result_directory, result_basename) if os.path.exists(result_path): # os.rename will fail overwriting on non-Unix. os.remove(result_path) os.rename(os.path.join(tmp_dist_dir, result_basename), result_path) return result_basename