Bug 820606 - update mozfile on mozilla-central to version 0.1;r=gps
authorJeff Hammel <jhammel@mozilla.com>
Wed, 12 Dec 2012 10:01:27 -0800
changeset 115804 29df94c927f89d070a77168de0d71b6588f53b1f
parent 115803 f5eed31150f2c56f19aa664208e5b26baead7dd5
child 115805 7ef53b8f1ff60cd7f796304cd3dc822ae7a653a2
push id19549
push userjhammel@mozilla.com
push dateWed, 12 Dec 2012 18:01:36 +0000
treeherdermozilla-inbound@29df94c927f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs820606
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 820606 - update mozfile on mozilla-central to version 0.1;r=gps
testing/mozbase/mozfile/mozfile/mozfile.py
testing/mozbase/mozfile/setup.py
--- a/testing/mozbase/mozfile/mozfile/mozfile.py
+++ b/testing/mozbase/mozfile/mozfile/mozfile.py
@@ -1,18 +1,12 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-"""
-mozfile.py:
-Cointains file functions for mozbase:
-https://bugzilla.mozilla.org/show_bug.cgi?id=774916
-"""
-
 import os
 import tarfile
 import zipfile
 
 __all__ = ['extract_tarball', 'extract_zip', 'extract', 'rmtree']
 
 
 ### utilities for extracting archives
@@ -84,37 +78,41 @@ def extract(src, dest=None):
         root = os.path.join(dest, name[:name.find('/')])
         if root not in top_level_files:
             top_level_files.append(root)
 
     return top_level_files
 
 
 def rmtree(dir):
-    """This is a replacement for shutil.rmtree that works better under
-    windows. Thanks to Bear at the OSAF for the code."""
+    """Removes the specified directory tree
 
+    This is a replacement for shutil.rmtree that works better under
+    windows."""
+    # (Thanks to Bear at the OSAF for the code.)
     if not os.path.exists(dir):
         return
     if os.path.islink(dir):
         os.remove(dir)
         return
 
     # Verify the directory is read/write/execute for the current user
     os.chmod(dir, 0700)
 
     # os.listdir below only returns a list of unicode filenames
     # if the parameter is unicode.
     # If a non-unicode-named dir contains a unicode filename,
     # that filename will get garbled.
     # So force dir to be unicode.
-    try:
-        dir = unicode(dir, "utf-8")
-    except:
-        print("rmtree: decoding from UTF-8 failed")
+    if not isinstance(dir, unicode):
+        try:
+            dir = unicode(dir, "utf-8")
+        except UnicodeDecodeError:
+            if os.environ.get('DEBUG') == '1':
+                print("rmtree: decoding from UTF-8 failed for directory: %s" %s)
 
     for name in os.listdir(dir):
         full_name = os.path.join(dir, name)
         # on Windows, if we don't have write permission we can't remove
         # the file/directory either, so turn that on
         if os.name == 'nt':
             if not os.access(full_name, os.W_OK):
                 # I think this is now redundant, but I don't have an NT
--- a/testing/mozbase/mozfile/setup.py
+++ b/testing/mozbase/mozfile/setup.py
@@ -1,28 +1,28 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 import os
 from setuptools import setup
 
-PACKAGE_VERSION = '0.0'
+PACKAGE_VERSION = '0.1'
 
 # get documentation from the README
 try:
     here = os.path.dirname(os.path.abspath(__file__))
     description = file(os.path.join(here, 'README.md')).read()
 except (OSError, IOError):
     description = ''
 
 setup(name='mozfile',
       version=PACKAGE_VERSION,
-      description="common file utilities for Mozilla python usage",
+      description="Library of file utilities for use in Mozilla testing",
       long_description=description,
       classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
       keywords='mozilla',
       author='Mozilla Automation and Tools team',
       author_email='tools@lists.mozilla.org',
       url='https://wiki.mozilla.org/Auto-tools/Projects/MozBase',
       license='MPL',
       packages=['mozfile'],