summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--TODO.md1
-rw-r--r--appdirs.py21
-rw-r--r--setup.py1
4 files changed, 21 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index 6becca7..7228e02 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,6 +7,7 @@ python:
- "3.6"
- "3.7"
- "3.8"
+ - "3.9"
- "pypy3"
script: python -m unittest discover
diff --git a/TODO.md b/TODO.md
deleted file mode 100644
index 81e466f..0000000
--- a/TODO.md
+++ /dev/null
@@ -1 +0,0 @@
-- add some Windows 7 examples
diff --git a/appdirs.py b/appdirs.py
index fcc26ad..08abda8 100644
--- a/appdirs.py
+++ b/appdirs.py
@@ -76,7 +76,7 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
if system == "win32":
if appauthor is None:
appauthor = appname
- const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA"
+ const = "CSIDL_APPDATA" if roaming else "CSIDL_LOCAL_APPDATA"
path = os.path.normpath(_get_win_folder(const))
if appname:
if appauthor is not False:
@@ -535,6 +535,15 @@ def _get_win_folder_with_jna(csidl_name):
return dir
+def _get_win_folder_from_environ(csidl_name):
+ env_var_name = {
+ "CSIDL_APPDATA": "APPDATA",
+ "CSIDL_COMMON_APPDATA": "ALLUSERSPROFILE",
+ "CSIDL_LOCAL_APPDATA": "LOCALAPPDATA",
+ }[csidl_name]
+
+ return os.environ[env_var_name]
+
if system == "win32":
try:
from ctypes import windll
@@ -542,7 +551,15 @@ if system == "win32":
try:
import com.sun.jna
except ImportError:
- _get_win_folder = _get_win_folder_from_registry
+ try:
+ if PY3:
+ import winreg as _winreg
+ else:
+ import _winreg
+ except ImportError:
+ _get_win_folder = _get_win_folder_from_environ
+ else:
+ _get_win_folder = _get_win_folder_from_registry
else:
_get_win_folder = _get_win_folder_with_jna
else:
diff --git a/setup.py b/setup.py
index bda95e3..f99fdbf 100644
--- a/setup.py
+++ b/setup.py
@@ -43,6 +43,7 @@ setup(
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Software Development :: Libraries :: Python Modules',