Python distutils.log.error() Examples
The following are 30
code examples of distutils.log.error().
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: setup.py From qgrid with Apache License 2.0 | 6 votes |
def js_prerelease(command, strict=False): """decorator for building minified js/css prior to another command""" class DecoratedCommand(command): def run(self): jsdeps = self.distribution.get_command_obj('jsdeps') if not is_repo and all(exists(t) for t in jsdeps.targets): # sdist, nothing to do command.run(self) return try: self.distribution.run_command('jsdeps') except Exception as e: missing = [t for t in jsdeps.targets if not exists(t)] if strict or missing: log.warn('rebuilding js and css failed') if missing: log.error('missing files: %s' % missing) raise e else: log.warn('rebuilding js and css failed (not a problem)') log.warn(str(e)) command.run(self) update_package_data(self.distribution) return DecoratedCommand
Example #2
Source File: setup.py From qgrid with Apache License 2.0 | 6 votes |
def run(self): has_npm = self.has_npm() if not has_npm: log.error("`npm` unavailable. If you're running this command using sudo, make sure `npm` is available to sudo") env = os.environ.copy() env['PATH'] = npm_path if self.should_run_npm_install(): log.info("Installing build dependencies with npm. This may take a while...") check_call(['npm', 'install'], cwd=node_root, stdout=sys.stdout, stderr=sys.stderr) os.utime(self.node_modules, None) for t in self.targets: if not exists(t): msg = 'Missing file: %s' % t if not has_npm: msg += '\nnpm is required to build a development version of a widget extension' raise ValueError(msg) # update package data in case this created new files update_package_data(self.distribution)
Example #3
Source File: setup.py From widget-cookiecutter with BSD 3-Clause "New" or "Revised" License | 6 votes |
def js_prerelease(command, strict=False): """decorator for building minified js/css prior to another command""" class DecoratedCommand(command): def run(self): jsdeps = self.distribution.get_command_obj('jsdeps') if not is_repo and all(os.path.exists(t) for t in jsdeps.targets): # sdist, nothing to do command.run(self) return try: self.distribution.run_command('jsdeps') except Exception as e: missing = [t for t in jsdeps.targets if not os.path.exists(t)] if strict or missing: log.warn('rebuilding js and css failed') if missing: log.error('missing files: %s' % missing) raise e else: log.warn('rebuilding js and css failed (not a problem)') log.warn(str(e)) command.run(self) update_package_data(self.distribution) return DecoratedCommand
Example #4
Source File: setup.py From widget-cookiecutter with BSD 3-Clause "New" or "Revised" License | 6 votes |
def run(self): has_npm = self.has_npm() if not has_npm: log.error("`npm` unavailable. If you're running this command using sudo, make sure `npm` is available to sudo") env = os.environ.copy() env['PATH'] = npm_path if self.should_run_npm_install(): log.info("Installing build dependencies with npm. This may take a while...") npmName = self.get_npm_name(); check_call([npmName, 'install'], cwd=node_root, stdout=sys.stdout, stderr=sys.stderr) os.utime(self.node_modules, None) for t in self.targets: if not os.path.exists(t): msg = 'Missing file: %s' % t if not has_npm: msg += '\nnpm is required to build a development version of a widget extension' raise ValueError(msg) # update package data in case this created new files update_package_data(self.distribution)
Example #5
Source File: config.py From Computable with MIT License | 5 votes |
def check_macro_true(self, symbol, headers=None, include_dirs=None): self._check_compiler() body = """ int main() { #if %s #else #error false or undefined macro #endif ; return 0; }""" % (symbol,) return self.try_compile(body, headers, include_dirs)
Example #6
Source File: config.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def check_macro_true(self, symbol, headers=None, include_dirs=None): self._check_compiler() body = """ int main(void) { #if %s #else #error false or undefined macro #endif ; return 0; }""" % (symbol,) return self.try_compile(body, headers, include_dirs)
Example #7
Source File: config.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def check_macro_true(self, symbol, headers=None, include_dirs=None): self._check_compiler() body = """ int main() { #if %s #else #error false or undefined macro #endif ; return 0; }""" % (symbol,) return self.try_compile(body, headers, include_dirs)
Example #8
Source File: lib2to3_ex.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def log_error(self, msg, *args, **kw): log.error(msg, *args)
Example #9
Source File: lib2to3_ex.py From oss-ftp with MIT License | 5 votes |
def log_error(self, msg, *args, **kw): log.error(msg, *args)
Example #10
Source File: config.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def check_func(self, func, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=False, call=False, call_args=None): # clean up distutils's config a bit: add void to main(), and # return a value. self._check_compiler() body = [] if decl: if type(decl) == str: body.append(decl) else: body.append("int %s (void);" % func) # Handle MSVC intrinsics: force MS compiler to make a function call. # Useful to test for some functions when built with optimization on, to # avoid build error because the intrinsic and our 'fake' test # declaration do not match. body.append("#ifdef _MSC_VER") body.append("#pragma function(%s)" % func) body.append("#endif") body.append("int main (void) {") if call: if call_args is None: call_args = '' body.append(" %s(%s);" % (func, call_args)) else: body.append(" %s;" % func) body.append(" return 0;") body.append("}") body = '\n'.join(body) + "\n" return self.try_link(body, headers, include_dirs, libraries, library_dirs)
Example #11
Source File: config.py From Computable with MIT License | 5 votes |
def check_func(self, func, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=False, call=False, call_args=None): # clean up distutils's config a bit: add void to main(), and # return a value. self._check_compiler() body = [] if decl: body.append("int %s (void);" % func) # Handle MSVC intrinsics: force MS compiler to make a function call. # Useful to test for some functions when built with optimization on, to # avoid build error because the intrinsic and our 'fake' test # declaration do not match. body.append("#ifdef _MSC_VER") body.append("#pragma function(%s)" % func) body.append("#endif") body.append("int main (void) {") if call: if call_args is None: call_args = '' body.append(" %s(%s);" % (func, call_args)) else: body.append(" %s;" % func) body.append(" return 0;") body.append("}") body = '\n'.join(body) + "\n" return self.try_link(body, headers, include_dirs, libraries, library_dirs)
Example #12
Source File: lib2to3_ex.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def log_error(self, msg, *args, **kw): log.error(msg, *args)
Example #13
Source File: config.py From Computable with MIT License | 5 votes |
def _check_compiler (self): old_config._check_compiler(self) from numpy.distutils.fcompiler import FCompiler, new_fcompiler if sys.platform == 'win32' and self.compiler.compiler_type == 'msvc': # XXX: hack to circumvent a python 2.6 bug with msvc9compiler: # initialize call query_vcvarsall, which throws an IOError, and # causes an error along the way without much information. We try to # catch it here, hoping it is early enough, and print an helpful # message instead of Error: None. if not self.compiler.initialized: try: self.compiler.initialize() except IOError: e = get_exception() msg = """\ Could not initialize compiler instance: do you have Visual Studio installed ? If you are trying to build with mingw, please use python setup.py build -c mingw32 instead ). If you have Visual Studio installed, check it is correctly installed, and the right version (VS 2008 for python 2.6, VS 2003 for 2.5, etc...). Original exception was: %s, and the Compiler class was %s ============================================================================""" \ % (e, self.compiler.__class__.__name__) print ("""\ ============================================================================""") raise distutils.errors.DistutilsPlatformError(msg) if not isinstance(self.fcompiler, FCompiler): self.fcompiler = new_fcompiler(compiler=self.fcompiler, dry_run=self.dry_run, force=1, c_compiler=self.compiler) if self.fcompiler is not None: self.fcompiler.customize(self.distribution) if self.fcompiler.get_version(): self.fcompiler.customize_cmd(self) self.fcompiler.show_customization()
Example #14
Source File: util.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def grok_environment_error (exc, prefix="error: "): # Function kept for backward compatibility. # Used to try clever things with EnvironmentErrors, # but nowadays str(exception) produces good messages. return prefix + str(exc) # Needed by 'split_quoted()'
Example #15
Source File: util.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def run_2to3(files, fixer_names=None, options=None, explicit=None): """Invoke 2to3 on a list of Python files. The files should all come from the build area, as the modification is done in-place. To reduce the build time, only files modified since the last invocation of this function should be passed in the files argument.""" if not files: return # Make this class local, to delay import of 2to3 from lib2to3.refactor import RefactoringTool, get_fixers_from_package class DistutilsRefactoringTool(RefactoringTool): def log_error(self, msg, *args, **kw): log.error(msg, *args) def log_message(self, msg, *args): log.info(msg, *args) def log_debug(self, msg, *args): log.debug(msg, *args) if fixer_names is None: fixer_names = get_fixers_from_package('lib2to3.fixes') r = DistutilsRefactoringTool(fixer_names, options=options) r.refactor(files, write=True)
Example #16
Source File: _msvccompiler.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def _get_vc_env(plat_spec): if os.getenv("DISTUTILS_USE_SDK"): return { key.lower(): value for key, value in os.environ.items() } vcvarsall, vcruntime = _find_vcvarsall(plat_spec) if not vcvarsall: raise DistutilsPlatformError("Unable to find vcvarsall.bat") try: out = subprocess.check_output( '"{}" {} && set'.format(vcvarsall, plat_spec), shell=True, stderr=subprocess.STDOUT, universal_newlines=True, ) except subprocess.CalledProcessError as exc: log.error(exc.output) raise DistutilsPlatformError("Error executing {}" .format(exc.cmd)) env = { key.lower(): value for key, _, value in (line.partition('=') for line in out.splitlines()) if key and value } if vcruntime: env['py_vcruntime_redist'] = vcruntime return env
Example #17
Source File: _msvccompiler.py From Imogen with MIT License | 5 votes |
def _get_vc_env(plat_spec): if os.getenv("DISTUTILS_USE_SDK"): return { key.lower(): value for key, value in os.environ.items() } vcvarsall, vcruntime = _find_vcvarsall(plat_spec) if not vcvarsall: raise DistutilsPlatformError("Unable to find vcvarsall.bat") try: out = subprocess.check_output( 'cmd /u /c "{}" {} && set'.format(vcvarsall, plat_spec), stderr=subprocess.STDOUT, ).decode('utf-16le', errors='replace') except subprocess.CalledProcessError as exc: log.error(exc.output) raise DistutilsPlatformError("Error executing {}" .format(exc.cmd)) env = { key.lower(): value for key, _, value in (line.partition('=') for line in out.splitlines()) if key and value } if vcruntime: env['py_vcruntime_redist'] = vcruntime return env
Example #18
Source File: config.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def check_func(self, func, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=False, call=False, call_args=None): # clean up distutils's config a bit: add void to main(), and # return a value. self._check_compiler() body = [] if decl: if type(decl) == str: body.append(decl) else: body.append("int %s (void);" % func) # Handle MSVC intrinsics: force MS compiler to make a function call. # Useful to test for some functions when built with optimization on, to # avoid build error because the intrinsic and our 'fake' test # declaration do not match. body.append("#ifdef _MSC_VER") body.append("#pragma function(%s)" % func) body.append("#endif") body.append("int main (void) {") if call: if call_args is None: call_args = '' body.append(" %s(%s);" % (func, call_args)) else: body.append(" %s;" % func) body.append(" return 0;") body.append("}") body = '\n'.join(body) + "\n" return self.try_link(body, headers, include_dirs, libraries, library_dirs)
Example #19
Source File: lib2to3_ex.py From anpr with Creative Commons Attribution 4.0 International | 5 votes |
def log_error(self, msg, *args, **kw): log.error(msg, *args)
Example #20
Source File: config.py From vnpy_crypto with MIT License | 5 votes |
def check_func(self, func, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=False, call=False, call_args=None): # clean up distutils's config a bit: add void to main(), and # return a value. self._check_compiler() body = [] if decl: if type(decl) == str: body.append(decl) else: body.append("int %s (void);" % func) # Handle MSVC intrinsics: force MS compiler to make a function call. # Useful to test for some functions when built with optimization on, to # avoid build error because the intrinsic and our 'fake' test # declaration do not match. body.append("#ifdef _MSC_VER") body.append("#pragma function(%s)" % func) body.append("#endif") body.append("int main (void) {") if call: if call_args is None: call_args = '' body.append(" %s(%s);" % (func, call_args)) else: body.append(" %s;" % func) body.append(" return 0;") body.append("}") body = '\n'.join(body) + "\n" return self.try_link(body, headers, include_dirs, libraries, library_dirs)
Example #21
Source File: lib2to3_ex.py From pex with Apache License 2.0 | 5 votes |
def log_error(self, msg, *args, **kw): log.error(msg, *args)
Example #22
Source File: ldist.py From lambda-setuptools with Apache License 2.0 | 5 votes |
def _install_dist_package(self): # Get the name of the package that we just built package_name = self.distribution.get_name() # Get the dist directory that bdist_wheel put the package in # Create the lambda build dir self._lambda_build_dir = os.path.join('build', 'ldist-'+package_name) build_dir = self._lambda_build_dir if getattr(self, 'build_layer'): build_dir = os.path.join(build_dir, getattr(self, 'layer_dir')) try: if os.path.exists(self._lambda_build_dir): shutil.rmtree(self._lambda_build_dir) log.info('creating {}'.format(self._lambda_build_dir)) os.makedirs(build_dir) except OSError as exc: if exc.errno == errno.EEXIST and os.path.isdir(self._lambda_build_dir): pass else: raise DistutilsInternalError('{} already exists and is not a directory'.format(self._lambda_build_dir)) log.info('installing package {} from {} into {}'.format(package_name, self._dist_dir, build_dir)) pip = Popen(['pip', 'install', '-f', self._dist_dir, '-t', build_dir, package_name], stdout=PIPE, stderr=PIPE) stdout, stderr = pip.communicate() if pip.returncode is not 0: log.info("pip stdout: {}".format(stdout)) log.error("pip stderr: {}".format(stderr)) raise DistutilsPlatformError('pip returned unsuccessfully') else: log.debug("pip stdout: {}".format(stdout)) log.debug("pip stderr: {}".format(stderr))
Example #23
Source File: lib2to3_ex.py From deepWordBug with Apache License 2.0 | 5 votes |
def log_error(self, msg, *args, **kw): log.error(msg, *args)
Example #24
Source File: util.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def run_2to3(files, fixer_names=None, options=None, explicit=None): """Invoke 2to3 on a list of Python files. The files should all come from the build area, as the modification is done in-place. To reduce the build time, only files modified since the last invocation of this function should be passed in the files argument.""" if not files: return # Make this class local, to delay import of 2to3 from lib2to3.refactor import RefactoringTool, get_fixers_from_package class DistutilsRefactoringTool(RefactoringTool): def log_error(self, msg, *args, **kw): log.error(msg, *args) def log_message(self, msg, *args): log.info(msg, *args) def log_debug(self, msg, *args): log.debug(msg, *args) if fixer_names is None: fixer_names = get_fixers_from_package('lib2to3.fixes') r = DistutilsRefactoringTool(fixer_names, options=options) r.refactor(files, write=True)
Example #25
Source File: util.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def grok_environment_error (exc, prefix="error: "): # Function kept for backward compatibility. # Used to try clever things with EnvironmentErrors, # but nowadays str(exception) produces good messages. return prefix + str(exc) # Needed by 'split_quoted()'
Example #26
Source File: config.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def check_func(self, func, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=False, call=False, call_args=None): # clean up distutils's config a bit: add void to main(), and # return a value. self._check_compiler() body = [] if decl: if type(decl) == str: body.append(decl) else: body.append("int %s (void);" % func) # Handle MSVC intrinsics: force MS compiler to make a function call. # Useful to test for some functions when built with optimization on, to # avoid build error because the intrinsic and our 'fake' test # declaration do not match. body.append("#ifdef _MSC_VER") body.append("#pragma function(%s)" % func) body.append("#endif") body.append("int main (void) {") if call: if call_args is None: call_args = '' body.append(" %s(%s);" % (func, call_args)) else: body.append(" %s;" % func) body.append(" return 0;") body.append("}") body = '\n'.join(body) + "\n" return self.try_link(body, headers, include_dirs, libraries, library_dirs)
Example #27
Source File: config.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def check_macro_true(self, symbol, headers=None, include_dirs=None): self._check_compiler() body = """ int main(void) { #if %s #else #error false or undefined macro #endif ; return 0; }""" % (symbol,) return self.try_compile(body, headers, include_dirs)
Example #28
Source File: config.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def check_func(self, func, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=False, call=False, call_args=None): # clean up distutils's config a bit: add void to main(), and # return a value. self._check_compiler() body = [] if decl: if type(decl) == str: body.append(decl) else: body.append("int %s (void);" % func) # Handle MSVC intrinsics: force MS compiler to make a function call. # Useful to test for some functions when built with optimization on, to # avoid build error because the intrinsic and our 'fake' test # declaration do not match. body.append("#ifdef _MSC_VER") body.append("#pragma function(%s)" % func) body.append("#endif") body.append("int main (void) {") if call: if call_args is None: call_args = '' body.append(" %s(%s);" % (func, call_args)) else: body.append(" %s;" % func) body.append(" return 0;") body.append("}") body = '\n'.join(body) + "\n" return self.try_link(body, headers, include_dirs, libraries, library_dirs)
Example #29
Source File: config.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def check_macro_true(self, symbol, headers=None, include_dirs=None): self._check_compiler() body = """ int main(void) { #if %s #else #error false or undefined macro #endif ; return 0; }""" % (symbol,) return self.try_compile(body, headers, include_dirs)
Example #30
Source File: lib2to3_ex.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def log_error(self, msg, *args, **kw): log.error(msg, *args)