Commits

Jason R. Coombs  committed b2629a6

Renamed util.platform to util.platform_. Fixes #112 (part two).

  • Participants
  • Parent commits 21f89e5
  • Tags 3.0.2

Comments (0)

Files changed (7)

 =======
 
 -----
+3.0.2
+-----
+
+* Renamed ``keyring.util.platform`` to ``keyring.util.platform_``. As reported
+  in Issue #112 and `mercurial_keyring #31
+  <https://bitbucket.org/Mekk/mercurial_keyring/issue/31>`_ and in `Mercurial
+  itself <http://bz.selenic.com/show_bug.cgi?id=4029>`_, Mercurial's Demand
+  Import does not honor ``absolute_import`` directives, so it's not possible
+  to have a module with the same name as another top-level module. A patch is
+  in place to fix this issue upstream, but to support older Mercurial
+  versions, this patch will remain for some time.
+
+-----
 3.0.1
 -----
 

File keyring/backends/file.py

 
 from ..py27compat import configparser
 
-import keyring.util.platform
+import keyring.util.platform_
 from keyring.errors import PasswordDeleteError
 from keyring.backend import KeyringBackend
 from keyring.util import properties
         The path to the file where passwords are stored. This property
         may be overridden by the subclass or at the instance level.
         """
-        return os.path.join(keyring.util.platform.data_root(), self.filename)
+        return os.path.join(keyring.util.platform_.data_root(), self.filename)
 
     @abc.abstractproperty
     def filename(self):

File keyring/backends/pyfs.py

 
 from ..py27compat import configparser
 
-import keyring.util.platform
+import keyring.util.platform_
 from keyring import errors
 from keyring.util.escape import escape as escape_for_ini
 from keyring.util import properties
         super(BasicKeyring, self).__init__()
         self._crypter = crypter
         self._filename = (filename or
-                          os.path.join(keyring.util.platform.data_root(),
+                          os.path.join(keyring.util.platform_.data_root(),
                                        self.__class__._filename))
         self._can_create = can_create
         self._cache_timeout = cache_timeout
         The path to the file where passwords are stored. This property
         may be overridden by the subclass or at the instance level.
         """
-        return os.path.join(keyring.util.platform.data_root(), self.filename)
+        return os.path.join(keyring.util.platform_.data_root(), self.filename)
 
     @property
     def filename(self):

File keyring/core.py

 
 from keyring import logger
 from keyring import backend
-from keyring.util import platform
+from keyring.util import platform_ as platform
 
 
 

File keyring/tests/test_core.py

 
 import keyring.backend
 import keyring.core
-import keyring.util.platform
 from keyring import errors
 
 PASSWORD_TEXT = "This is password"

File keyring/util/platform.py

-from __future__ import absolute_import
-
-import os
-import platform
-
-def _data_root_Windows():
-	try:
-		root = os.environ['LOCALAPPDATA']
-	except KeyError:
-		# Windows XP
-		root = os.path.join(os.environ['USERPROFILE'], 'Local Settings')
-	return os.path.join(root, 'Python Keyring')
-
-def _data_root_Linux():
-	"""
-	Use freedesktop.org Base Dir Specfication to determine storage
-	location.
-	"""
-	fallback = os.path.expanduser('~/.local/share')
-	root = os.environ.get('XDG_DATA_HOME', None) or fallback
-	return os.path.join(root, 'python_keyring')
-
-# by default, use Unix convention
-data_root = globals().get('_data_root_' + platform.system(), _data_root_Linux)

File keyring/util/platform_.py

+from __future__ import absolute_import
+
+import os
+import platform
+
+def _data_root_Windows():
+	try:
+		root = os.environ['LOCALAPPDATA']
+	except KeyError:
+		# Windows XP
+		root = os.path.join(os.environ['USERPROFILE'], 'Local Settings')
+	return os.path.join(root, 'Python Keyring')
+
+def _data_root_Linux():
+	"""
+	Use freedesktop.org Base Dir Specfication to determine storage
+	location.
+	"""
+	fallback = os.path.expanduser('~/.local/share')
+	root = os.environ.get('XDG_DATA_HOME', None) or fallback
+	return os.path.join(root, 'python_keyring')
+
+# by default, use Unix convention
+data_root = globals().get('_data_root_' + platform.system(), _data_root_Linux)