Python distutils.log.info() Examples
The following are 30
code examples of distutils.log.info().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
distutils.log
, or try the search function
.
Example #1
Source File: egg_info.py From jbox with MIT License | 6 votes |
def write_pkg_info(cmd, basename, filename): log.info("writing %s", filename) if not cmd.dry_run: metadata = cmd.distribution.metadata metadata.version, oldver = cmd.egg_version, metadata.version metadata.name, oldname = cmd.egg_name, metadata.name try: # write unescaped data to PKG-INFO, so older pkg_resources # can still parse it metadata.write_pkg_info(cmd.egg_info) finally: metadata.name, metadata.version = oldname, oldver safe = getattr(cmd.distribution, 'zip_safe', None) bdist_egg.write_safety_flag(cmd.egg_info, safe)
Example #2
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def __init__(self, default_lib_dirs=default_lib_dirs, default_include_dirs=default_include_dirs, verbosity=1, ): self.__class__.info = {} self.local_prefixes = [] defaults = {'library_dirs': os.pathsep.join(default_lib_dirs), 'include_dirs': os.pathsep.join(default_include_dirs), 'runtime_library_dirs': os.pathsep.join(default_runtime_dirs), 'rpath': '', 'src_dirs': os.pathsep.join(default_src_dirs), 'search_static_first': str(self.search_static_first), 'extra_compile_args': '', 'extra_link_args': ''} self.cp = ConfigParser(defaults) self.files = [] self.files.extend(get_standard_file('.numpy-site.cfg')) self.files.extend(get_standard_file('site.cfg')) self.parse_config_files() if self.section is not None: self.search_static_first = self.cp.getboolean( self.section, 'search_static_first') assert isinstance(self.search_static_first, int)
Example #3
Source File: azure_bdist_wheel.py From botbuilder-python with MIT License | 6 votes |
def write_wheelfile( self, wheelfile_base, generator="bdist_wheel (" + wheel_version + ")" ): from email.message import Message msg = Message() msg["Wheel-Version"] = "1.0" # of the spec msg["Generator"] = generator msg["Root-Is-Purelib"] = str(self.root_is_pure).lower() # Doesn't work for bdist_wininst impl_tag, abi_tag, plat_tag = self.get_tag() for impl in impl_tag.split("."): for abi in abi_tag.split("."): for plat in plat_tag.split("."): msg["Tag"] = "-".join((impl, abi, plat)) wheelfile_path = os.path.join(wheelfile_base, "WHEEL") logger.info("creating %s", wheelfile_path) with open(wheelfile_path, "w") as f: Generator(f, maxheaderlen=0).flatten(msg)
Example #4
Source File: setupbase.py From jupyterlab-sidecar with BSD 3-Clause "New" or "Revised" License | 6 votes |
def ensure_targets(targets): """Return a Command that checks that certain files exist. Raises a ValueError if any of the files are missing. Note: The check is skipped if the `--skip-npm` flag is used. """ class TargetsCheck(BaseCommand): def run(self): if skip_npm: log.info('Skipping target checks') return missing = [t for t in targets if not os.path.exists(t)] if missing: raise ValueError(('missing files: %s' % missing)) return TargetsCheck # `shutils.which` function copied verbatim from the Python-3.3 source.
Example #5
Source File: azure_bdist_wheel.py From botbuilder-python with MIT License | 6 votes |
def write_record(self, bdist_dir, distinfo_dir): if self.azure_namespace_package: # Split and remove last part, assuming it's "nspkg" subparts = self.azure_namespace_package.split("-")[0:-1] folder_with_init = [ os.path.join(*subparts[0 : i + 1]) for i in range(len(subparts)) ] for azure_sub_package in folder_with_init: init_file = os.path.join(bdist_dir, azure_sub_package, "__init__.py") if os.path.isfile(init_file): logger.info( "manually remove {} while building the wheel".format(init_file) ) os.remove(init_file) else: raise ValueError( "Unable to find {}. Are you sure of your namespace package?".format( init_file ) ) bdist_wheel.write_record(self, bdist_dir, distinfo_dir)
Example #6
Source File: bdist_wheel.py From jbox with MIT License | 6 votes |
def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel.__version__ + ')'): from email.message import Message msg = Message() msg['Wheel-Version'] = '1.0' # of the spec msg['Generator'] = generator msg['Root-Is-Purelib'] = str(self.root_is_pure).lower() # Doesn't work for bdist_wininst impl_tag, abi_tag, plat_tag = self.get_tag() for impl in impl_tag.split('.'): for abi in abi_tag.split('.'): for plat in plat_tag.split('.'): msg['Tag'] = '-'.join((impl, abi, plat)) wheelfile_path = os.path.join(wheelfile_base, 'WHEEL') logger.info('creating %s', wheelfile_path) with open(wheelfile_path, 'w') as f: Generator(f, maxheaderlen=0).flatten(msg)
Example #7
Source File: easy_install.py From jbox with MIT License | 6 votes |
def run_setup(self, setup_script, setup_base, args): sys.modules.setdefault('distutils.command.bdist_egg', bdist_egg) sys.modules.setdefault('distutils.command.egg_info', egg_info) args = list(args) if self.verbose > 2: v = 'v' * (self.verbose - 1) args.insert(0, '-' + v) elif self.verbose < 2: args.insert(0, '-q') if self.dry_run: args.insert(0, '-n') log.info( "Running %s %s", setup_script[len(setup_base) + 1:], ' '.join(args) ) try: run_setup(setup_script, args) except SystemExit as v: raise DistutilsError("Setup script exited with %s" % (v.args[0],))
Example #8
Source File: easy_install.py From jbox with MIT License | 6 votes |
def write_script(self, script_name, contents, mode="t", blockers=()): """Write an executable file to the scripts directory""" self.delete_blockers( # clean up old .py/.pyw w/o a script [os.path.join(self.script_dir, x) for x in blockers] ) log.info("Installing %s script to %s", script_name, self.script_dir) target = os.path.join(self.script_dir, script_name) self.add_output(target) mask = current_umask() if not self.dry_run: ensure_directory(target) if os.path.exists(target): os.unlink(target) with open(target, "w" + mode) as f: f.write(contents) chmod(target, 0o777 - mask)
Example #9
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def check_libs(self, lib_dirs, libs, opt_libs=[]): """If static or shared libraries are available then return their info dictionary. Checks for all libraries as shared libraries first, then static (or vice versa if self.search_static_first is True). """ exts = self.library_extensions() info = None for ext in exts: info = self._check_libs(lib_dirs, libs, opt_libs, [ext]) if info is not None: break if not info: log.info(' libraries %s not found in %s', ','.join(libs), lib_dirs) return info
Example #10
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_ver_info(self, ver_param): """Returns True on successful version detection, else False""" lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() libs = self.get_libs(self.section + '_libs', ver_param['libs']) info = self.check_libs(lib_dirs, libs) if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_paths(d, ver_param['includes'])) \ == len(ver_param['includes']): dict_append(info, include_dirs=[d]) flag = 1 incl_dirs = [d] break if flag: dict_append(info, define_macros=ver_param['macros']) else: info = None if info is not None: self.set_info(**info) return True else: log.info(' %s not found' % (ver_param['name'])) return False
Example #11
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def _check_libs(self, lib_dirs, libs, opt_libs, exts): """Find mandatory and optional libs in expected paths. Missing optional libraries are silently forgotten. """ if not is_sequence(lib_dirs): lib_dirs = [lib_dirs] # First, try to find the mandatory libraries found_dirs, found_libs = self._find_libs(lib_dirs, libs, exts) if len(found_libs) > 0 and len(found_libs) == len(libs): # Now, check for optional libraries opt_found_dirs, opt_found_libs = self._find_libs(lib_dirs, opt_libs, exts) found_libs.extend(opt_found_libs) for lib_dir in opt_found_dirs: if lib_dir not in found_dirs: found_dirs.append(lib_dir) info = {'libraries': found_libs, 'library_dirs': found_dirs} return info else: return None
Example #12
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() info = None for d in lib_dirs: p = self.combine_paths(d, ['djbfft.a']) if p: info = {'extra_objects': p} break p = self.combine_paths(d, ['libdjbfft.a', 'libdjbfft' + so_ext]) if p: info = {'libraries': ['djbfft'], 'library_dirs': [d]} break if info is None: return for d in incl_dirs: if len(self.combine_paths(d, ['fftc8.h', 'fftfreq.h'])) == 2: dict_append(info, include_dirs=[d], define_macros=[('SCIPY_DJBFFT_H', None)]) self.set_info(**info) return return
Example #13
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() mkl_libs = self.get_libs('mkl_libs', self._lib_mkl) info = self.check_libs2(lib_dirs, mkl_libs) if info is None: return dict_append(info, define_macros=[('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)], include_dirs=incl_dirs) if sys.platform == 'win32': pass # win32 has no pthread library else: dict_append(info, libraries=['pthread']) self.set_info(**info)
Example #14
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): lib_dirs = self.get_lib_dirs() info = {} atlas_libs = self.get_libs('atlas_libs', self._lib_names) atlas = self.check_libs2(lib_dirs, atlas_libs, []) if atlas is None: return include_dirs = self.get_include_dirs() h = (self.combine_paths(lib_dirs + include_dirs, 'cblas.h') or [None]) h = h[0] if h: h = os.path.dirname(h) dict_append(info, include_dirs=[h]) info['language'] = 'c' info['define_macros'] = [('HAVE_CBLAS', None)] atlas_version, atlas_extra_info = get_atlas_version(**atlas) dict_append(atlas, **atlas_extra_info) dict_append(info, **atlas) self.set_info(**info) return
Example #15
Source File: install_egg_info.py From jbox with MIT License | 6 votes |
def install_namespaces(self): nsp = self._get_all_ns_packages() if not nsp: return filename, ext = os.path.splitext(self.target) filename += '-nspkg.pth' self.outputs.append(filename) log.info("Installing %s", filename) lines = map(self._gen_nspkg_line, nsp) if self.dry_run: # always generate the lines, even in dry run list(lines) return with open(filename, 'wt') as f: f.writelines(lines)
Example #16
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): lib_dirs = self.get_lib_dirs() info = {} atlas_libs = self.get_libs('atlas_libs', self._lib_names + self._lib_atlas) atlas = self.check_libs2(lib_dirs, atlas_libs, []) if atlas is None: return include_dirs = self.get_include_dirs() h = (self.combine_paths(lib_dirs + include_dirs, 'cblas.h') or [None]) h = h[0] if h: h = os.path.dirname(h) dict_append(info, include_dirs=[h]) info['language'] = 'c' info['define_macros'] = [('HAVE_CBLAS', None)] atlas_version, atlas_extra_info = get_atlas_version(**atlas) dict_append(atlas, **atlas_extra_info) dict_append(info, **atlas) self.set_info(**info) return
Example #17
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): lib_dirs = self.get_lib_dirs() blas_libs = self.get_libs('blas_libs', self._lib_names) info = self.check_libs(lib_dirs, blas_libs, []) if info is None: return else: info['include_dirs'] = self.get_include_dirs() if platform.system() == 'Windows': # The check for windows is needed because has_cblas uses the # same compiler that was used to compile Python and msvc is # often not installed when mingw is being used. This rough # treatment is not desirable, but windows is tricky. info['language'] = 'f77' # XXX: is it generally true? else: lib = self.has_cblas(info) if lib is not None: info['language'] = 'c' info['libraries'] = [lib] info['define_macros'] = [('HAVE_CBLAS', None)] self.set_info(**info)
Example #18
Source File: develop.py From jbox with MIT License | 6 votes |
def uninstall_link(self): if os.path.exists(self.egg_link): log.info("Removing %s (link to %s)", self.egg_link, self.egg_base) egg_link_file = open(self.egg_link) contents = [line.rstrip() for line in egg_link_file] egg_link_file.close() if contents not in ([self.egg_path], [self.egg_path, self.setup_path]): log.warn("Link points to %s: uninstall aborted", contents) return if not self.dry_run: os.unlink(self.egg_link) if not self.dry_run: self.update_pth(self.dist) # remove any .pth link to us if self.distribution.scripts: # XXX should also check for entry point scripts! log.warn("Note: you must uninstall or replace scripts manually!")
Example #19
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): lib_dirs = self.get_lib_dirs() blis_libs = self.get_libs('libraries', self._lib_names) if blis_libs == self._lib_names: blis_libs = self.get_libs('blis_libs', self._lib_names) info = self.check_libs2(lib_dirs, blis_libs, []) if info is None: return # Add include dirs incl_dirs = self.get_include_dirs() dict_append(info, language='c', define_macros=[('HAVE_CBLAS', None)], include_dirs=incl_dirs) self.set_info(**info)
Example #20
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): if sys.platform in ['win32']: return lib_dirs = self.get_lib_dirs() include_dirs = self.get_include_dirs() x11_libs = self.get_libs('x11_libs', ['X11']) info = self.check_libs(lib_dirs, x11_libs, []) if info is None: return inc_dir = None for d in include_dirs: if self.combine_paths(d, 'X11/X.h'): inc_dir = d break if inc_dir is not None: dict_append(info, include_dirs=[inc_dir]) self.set_info(**info)
Example #21
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): lib_dirs = self.get_lib_dirs() amd_libs = self.get_libs('amd_libs', self._lib_names) info = self.check_libs(lib_dirs, amd_libs, []) if info is None: return include_dirs = self.get_include_dirs() inc_dir = None for d in include_dirs: p = self.combine_paths(d, 'amd.h') if p: inc_dir = os.path.dirname(p[0]) break if inc_dir is not None: dict_append(info, include_dirs=[inc_dir], define_macros=[('SCIPY_AMD_H', None)], swig_opts=['-I' + inc_dir]) self.set_info(**info) return
Example #22
Source File: system_info.py From recruit with Apache License 2.0 | 6 votes |
def calc_info(self): lib_dirs = self.get_lib_dirs() umfpack_libs = self.get_libs('umfpack_libs', self._lib_names) info = self.check_libs(lib_dirs, umfpack_libs, []) if info is None: return include_dirs = self.get_include_dirs() inc_dir = None for d in include_dirs: p = self.combine_paths(d, ['', 'umfpack'], 'umfpack.h') if p: inc_dir = os.path.dirname(p[0]) break if inc_dir is not None: dict_append(info, include_dirs=[inc_dir], define_macros=[('SCIPY_UMFPACK_H', None)], swig_opts=['-I' + inc_dir]) dict_append(info, **get_info('amd')) self.set_info(**info) return
Example #23
Source File: bdist_egg.py From jbox with MIT License | 6 votes |
def do_install_data(self): # Hack for packages that install data to install's --install-lib self.get_finalized_command('install').install_lib = self.bdist_dir site_packages = os.path.normcase(os.path.realpath(_get_purelib())) old, self.distribution.data_files = self.distribution.data_files, [] for item in old: if isinstance(item, tuple) and len(item) == 2: if os.path.isabs(item[0]): realpath = os.path.realpath(item[0]) normalized = os.path.normcase(realpath) if normalized == site_packages or normalized.startswith( site_packages + os.sep ): item = realpath[len(site_packages) + 1:], item[1] # XXX else: raise ??? self.distribution.data_files.append(item) try: log.info("installing package data to %s" % self.bdist_dir) self.call_command('install_data', force=0, root=None) finally: self.distribution.data_files = old
Example #24
Source File: rotate.py From jbox with MIT License | 6 votes |
def run(self): self.run_command("egg_info") from glob import glob for pattern in self.match: pattern = self.distribution.get_name() + '*' + pattern files = glob(os.path.join(self.dist_dir, pattern)) files = [(os.path.getmtime(f), f) for f in files] files.sort() files.reverse() log.info("%d file(s) matching %s", len(files), pattern) files = files[self.keep:] for (t, f) in files: log.info("Deleting %s", f) if not self.dry_run: if os.path.isdir(f): shutil.rmtree(f) else: os.unlink(f)
Example #25
Source File: egg_info.py From jbox with MIT License | 6 votes |
def _add_egg_info(self, cmd): """ Add paths for egg-info files for an external egg-base. The egg-info files are written to egg-base. If egg-base is outside the current working directory, this method searchs the egg-base directory for files to include in the manifest. Uses distutils.filelist.findall (which is really the version monkeypatched in by setuptools/__init__.py) to perform the search. Since findall records relative paths, prefix the returned paths with cmd.egg_base, so add_default's include_pattern call (which is looking for the absolute cmd.egg_info) will match them. """ if cmd.egg_base == os.curdir: # egg-info files were already added by something else return discovered = distutils.filelist.findall(cmd.egg_base) resolved = (os.path.join(cmd.egg_base, path) for path in discovered) self.filelist.allfiles.extend(resolved)
Example #26
Source File: sdist.py From jbox with MIT License | 6 votes |
def read_manifest(self): """Read the manifest file (named by 'self.manifest') and use it to fill in 'self.filelist', the list of files to include in the source distribution. """ log.info("reading manifest file '%s'", self.manifest) manifest = open(self.manifest, 'rbU') for line in manifest: # The manifest must contain UTF-8. See #303. if six.PY3: try: line = line.decode('UTF-8') except UnicodeDecodeError: log.warn("%r not UTF-8 decodable -- skipping" % line) continue # ignore comments and blank lines line = line.strip() if line.startswith('#') or not line: continue self.filelist.append(line) manifest.close()
Example #27
Source File: package_index.py From jbox with MIT License | 5 votes |
def _download_hg(self, url, filename): filename = filename.split('#',1)[0] url, rev = self._vcs_split_rev_from_url(url, pop_prefix=True) self.info("Doing hg clone from %s to %s", url, filename) os.system("hg clone --quiet %s %s" % (url, filename)) if rev is not None: self.info("Updating to %s", rev) os.system("(cd %s && hg up -C -r %s >&-)" % ( filename, rev, )) return filename
Example #28
Source File: package_index.py From jbox with MIT License | 5 votes |
def info(self, msg, *args): log.info(msg, *args)
Example #29
Source File: package_index.py From jbox with MIT License | 5 votes |
def _download_git(self, url, filename): filename = filename.split('#',1)[0] url, rev = self._vcs_split_rev_from_url(url, pop_prefix=True) self.info("Doing git clone from %s to %s", url, filename) os.system("git clone --quiet %s %s" % (url, filename)) if rev is not None: self.info("Checking out %s", rev) os.system("(cd %s && git checkout --quiet %s)" % ( filename, rev, )) return filename
Example #30
Source File: setopt.py From jbox with MIT License | 5 votes |
def edit_config(filename, settings, dry_run=False): """Edit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to delete that setting. """ log.debug("Reading configuration from %s", filename) opts = configparser.RawConfigParser() opts.read([filename]) for section, options in settings.items(): if options is None: log.info("Deleting section [%s] from %s", section, filename) opts.remove_section(section) else: if not opts.has_section(section): log.debug("Adding new section [%s] to %s", section, filename) opts.add_section(section) for option, value in options.items(): if value is None: log.debug( "Deleting %s.%s from %s", section, option, filename ) opts.remove_option(section, option) if not opts.options(section): log.info("Deleting empty [%s] section from %s", section, filename) opts.remove_section(section) else: log.debug( "Setting %s.%s to %r in %s", section, option, value, filename ) opts.set(section, option, value) log.info("Writing %s", filename) if not dry_run: with open(filename, 'w') as f: opts.write(f)