def make_distribution(self): """Minimize path lenght to avoid windows issues.""" # Copied from distutils.command.sdist.sdist.make_distribution # Don't warn about missing meta-data here -- should be (and is!) # done elsewhere. base_dir = self.distribution.get_version() base_name = os.path.join(self.dist_dir, options.get_egg_name(self.distribution) + ".msdeploy") self.make_release_tree(base_dir, self.filelist.files) archive_files = [] # remember names of files we create file = self.make_archive(base_name, "zip", base_dir=base_dir, owner=self.owner, group=self.group) archive_files.append(file) pyversion = sysconfig.get_python_version() self.distribution.dist_files.append(("bdist_dumb", pyversion, file)) self.archive_files = archive_files if not self.keep_temp: dir_util.remove_tree(base_dir, dry_run=self.dry_run)
def run(self): """ Build IIS WSGI Web Platform Installer feed. Calculates package sizes and sha1 hashes and renders a Web Platform Installer feed from that data and distribution metadata. msdeploy_bdists A command-line option containing a list of paths to distributions each containing built MSDeploy packages to include in the feed. extras_require['bdist_webpi'] A setup() kwarg containing a list of depdendencies to retrieve from the environment and for which to include entries in the feed. """ for path in self.msdeploy_bdists: distribution = self.add_msdeploy(path) self.distributions.append(distribution) if not distribution.has_msdeploy_manifest: continue distribution.msdeploy_app_name = clean_webpi.get_app_name(path) extras = self.distribution.extras_require or {} for name in extras.get('webpi_eggs', ()): distribution = self.add_dist(name) self.distributions.append(distribution) dist_feed = os.path.join( self.dist_dir, options.get_egg_name(self.distribution) + '.webpi.xml') self.mkpath(self.dist_dir) self.write_feed(dist_feed) self.distribution.dist_files.append(('webpi', '', dist_feed)) logger.info('Local Web Platform Installer feed URL:\n{0}'.format( urlparse.urlunsplit(('file', '', urllib.pathname2url( os.path.abspath(dist_feed)), '', ''))))
def add_msdeploy(self, path, *args): cwd = os.getcwd() try: os.chdir(path) distribution = self.distribution if os.path.abspath(path) != os.path.abspath(cwd): distribution = core.run_setup( 'setup.py', stop_after='commandline') distribution.build = distribution.get_command_obj('build') distribution.build.ensure_finalized() distribution.has_msdeploy_manifest = ( 'build_msdeploy' in distribution.build.get_sub_commands()) if not distribution.has_msdeploy_manifest: raise errors.DistutilsFileError( 'No Web Deploy manifest found for {0}'.format(path)) distribution.msdeploy_file = options.get_egg_name( distribution) + '.msdeploy.zip' distribution.msdeploy_package = os.path.abspath( os.path.join('dist', distribution.msdeploy_file)) distribution.msdeploy_package_url = urlparse.urlunsplit(( 'file', '', urllib.pathname2url(distribution.msdeploy_package), '', '')) webpi_size = os.path.getsize(distribution.msdeploy_package) cmd = ['fciv', '-sha1', distribution.msdeploy_package] webpi_sha1 = '' try: webpi_sha1_output = subprocess.check_output(cmd) except OSError, error: if error.errno == errno.ENOENT: logger.exception('Error getting SHA1:\n{0}'.format( ' '.join(cmd))) else: raise else:
def make_distribution(self): """Minimize path lenght to avoid windows issues.""" # Copied from distutils.command.sdist.sdist.make_distribution # Don't warn about missing meta-data here -- should be (and is!) # done elsewhere. base_dir = self.distribution.get_version() base_name = os.path.join( self.dist_dir, options.get_egg_name(self.distribution) + '.msdeploy') self.make_release_tree(base_dir, self.filelist.files) archive_files = [] # remember names of files we create file = self.make_archive(base_name, 'zip', base_dir=base_dir, owner=self.owner, group=self.group) archive_files.append(file) pyversion = sysconfig.get_python_version() self.distribution.dist_files.append(('bdist_dumb', pyversion, file)) self.archive_files = archive_files if not self.keep_temp: dir_util.remove_tree(base_dir, dry_run=self.dry_run)