Anonymous avatar Anonymous committed 1d5dd6a

Use proper log levels

Comments (0)

Files changed (1)

distribute_setup.py

 def _install(tarball, install_args=()):
     # extracting the tarball
     tmpdir = tempfile.mkdtemp()
-    log.warn('Extracting in %s', tmpdir)
+    log.debug('Extracting in %s', tmpdir)
     old_wd = os.getcwd()
     try:
         os.chdir(tmpdir)
         # going in the directory
         subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
         os.chdir(subdir)
-        log.warn('Now working in %s', subdir)
+        log.debug('Now working in %s', subdir)
 
         # installing
-        log.warn('Installing Distribute')
+        log.debug('Installing Distribute')
         if not _python_cmd('setup.py', 'install', *install_args):
-            log.warn('Something went wrong during the installation.')
-            log.warn('See the error message above.')
+            log.error('Something went wrong during the installation.')
+            log.error('See the error message above.')
     finally:
         os.chdir(old_wd)
 
 def _build_egg(egg, tarball, to_dir):
     # extracting the tarball
     tmpdir = tempfile.mkdtemp()
-    log.warn('Extracting in %s', tmpdir)
+    log.debug('Extracting in %s', tmpdir)
     old_wd = os.getcwd()
     try:
         os.chdir(tmpdir)
         # going in the directory
         subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
         os.chdir(subdir)
-        log.warn('Now working in %s', subdir)
+        log.debug('Now working in %s', subdir)
 
         # building an egg
-        log.warn('Building a Distribute egg in %s', to_dir)
+        log.debug('Building a Distribute egg in %s', to_dir)
         _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
 
     finally:
         os.chdir(old_wd)
     # returning the result
-    log.warn(egg)
+    log.debug(egg)
     if not os.path.exists(egg):
         raise IOError('Could not build the egg.')
 
     src = dst = None
     if not os.path.exists(saveto):  # Avoid repeated downloads
         try:
-            log.warn("Downloading %s", url)
+            log.debug("Downloading %s", url)
             src = urlopen(url)
             # Read/write all in one block, so we don't create a corrupt file
             # if the download is interrupted.
     existing_content = open(path).read()
     if existing_content == content:
         # already patched
-        log.warn('Already patched.')
+        log.debug('Already patched.')
         return False
-    log.warn('Patching...')
+    log.debug('Patching...')
     _rename_path(path)
     f = open(path, 'w')
     try:
 
 def _rename_path(path):
     new_name = path + '.OLD.%s' % time.time()
-    log.warn('Renaming %s into %s', path, new_name)
+    log.debug('Renaming %s into %s', path, new_name)
     os.rename(path, new_name)
     return new_name
 
 def _remove_flat_installation(placeholder):
     if not os.path.isdir(placeholder):
-        log.warn('Unkown installation at %s', placeholder)
+        log.debug('Unkown installation at %s', placeholder)
         return False
     found = False
     for file in os.listdir(placeholder):
             found = True
             break
     if not found:
-        log.warn('Could not locate setuptools*.egg-info')
+        log.debug('Could not locate setuptools*.egg-info')
         return
 
-    log.warn('Removing elements out of the way...')
+    log.debug('Removing elements out of the way...')
     pkg_info = os.path.join(placeholder, file)
     if os.path.isdir(pkg_info):
         patched = _patch_egg_dir(pkg_info)
         patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)
 
     if not patched:
-        log.warn('%s already patched.', pkg_info)
+        log.debug('%s already patched.', pkg_info)
         return False
     # now let's move the files out of the way
     for element in ('setuptools', 'pkg_resources.py', 'site.py'):
         if os.path.exists(element):
             _rename_path(element)
         else:
-            log.warn('Could not find the %s element of the '
+            log.debug('Could not find the %s element of the '
                      'Setuptools distribution', element)
     return True
 
 _remove_flat_installation = _no_sandbox(_remove_flat_installation)
 
 def _after_install(dist):
-    log.warn('After install bootstrap.')
+    log.debug('After install bootstrap.')
     placeholder = dist.get_command_obj('install').install_purelib
     _create_fake_setuptools_pkg_info(placeholder)
 
 def _create_fake_setuptools_pkg_info(placeholder):
     if not placeholder or not os.path.exists(placeholder):
-        log.warn('Could not find the install location')
+        log.debug('Could not find the install location')
         return
     pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
     setuptools_file = 'setuptools-%s-py%s.egg-info' % \
             (SETUPTOOLS_FAKED_VERSION, pyver)
     pkg_info = os.path.join(placeholder, setuptools_file)
     if os.path.exists(pkg_info):
-        log.warn('%s already exists', pkg_info)
+        log.debug('%s already exists', pkg_info)
         return
 
-    log.warn('Creating %s', pkg_info)
+    log.debug('Creating %s', pkg_info)
     f = open(pkg_info, 'w')
     try:
         f.write(SETUPTOOLS_PKG_INFO)
         f.close()
 
     pth_file = os.path.join(placeholder, 'setuptools.pth')
-    log.warn('Creating %s', pth_file)
+    log.debug('Creating %s', pth_file)
     f = open(pth_file, 'w')
     try:
         f.write(os.path.join(os.curdir, setuptools_file))
     pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
     if os.path.exists(pkg_info):
         if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):
-            log.warn('%s already patched.', pkg_info)
+            log.debug('%s already patched.', pkg_info)
             return False
     _rename_path(path)
     os.mkdir(path)
 _patch_egg_dir = _no_sandbox(_patch_egg_dir)
 
 def _before_install():
-    log.warn('Before install bootstrap.')
+    log.debug('Before install bootstrap.')
     _fake_setuptools()
 
 
 
 
 def _fake_setuptools():
-    log.warn('Scanning installed packages')
+    log.debug('Scanning installed packages')
     try:
         import pkg_resources
     except ImportError:
         # we're cool
-        log.warn('Setuptools or Distribute does not seem to be installed.')
+        log.debug('Setuptools or Distribute does not seem to be installed.')
         return
     ws = pkg_resources.working_set
     try:
         setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools'))
 
     if setuptools_dist is None:
-        log.warn('No setuptools distribution found')
+        log.debug('No setuptools distribution found')
         return
     # detecting if it was already faked
     setuptools_location = setuptools_dist.location
-    log.warn('Setuptools installation detected at %s', setuptools_location)
+    log.debug('Setuptools installation detected at %s', setuptools_location)
 
     # if --root or --preix was provided, and if
     # setuptools is not located in them, we don't patch it
     if not _under_prefix(setuptools_location):
-        log.warn('Not patching, --root or --prefix is installing Distribute'
+        log.debug('Not patching, --root or --prefix is installing Distribute'
                  ' in another location')
         return
 
     # let's see if its an egg
     if not setuptools_location.endswith('.egg'):
-        log.warn('Non-egg installation')
+        log.debug('Non-egg installation')
         res = _remove_flat_installation(setuptools_location)
         if not res:
             return
     else:
-        log.warn('Egg installation')
+        log.debug('Egg installation')
         pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')
         if (os.path.exists(pkg_info) and
             _same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
-            log.warn('Already patched.')
+            log.debug('Already patched.')
             return
-        log.warn('Patching...')
+        log.debug('Patching...')
         # let's create a fake egg replacing setuptools one
         res = _patch_egg_dir(setuptools_location)
         if not res:
             return
-    log.warn('Patched done.')
+    log.debug('Patched done.')
     _relaunch()
 
 
 def _relaunch():
-    log.warn('Relaunching...')
+    log.debug('Relaunching...')
     # we have to relaunch the process
     # pip marker to avoid a relaunch bug
     if sys.argv[:3] == ['-c', 'install', '--single-version-externally-managed']:
     install_args = []
     user_install = '--user' in argv
     if user_install and sys.version_info < (2,6):
-        log.warn("--user requires Python 2.6 or later")
+        log.error("--user requires Python 2.6 or later")
         raise SystemExit(1)
     if user_install:
         install_args.append('--user')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.