From 1ad3e9412908ddc1e8d8ab79aa60a848071f9151 Mon Sep 17 00:00:00 2001 From: John G Evans Date: Fri, 26 Jul 2013 14:32:53 -0400 Subject: [PATCH 1/5] Using os.path.expanduser on windows to figure out where to put config file. --- glymur/lib/config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/glymur/lib/config.py b/glymur/lib/config.py index 7fcaeb6..21c1205 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -143,10 +143,11 @@ def get_configdir(): if 'XDG_CONFIG_HOME' in os.environ: return os.path.join(os.environ['XDG_CONFIG_HOME'], 'glymur') - if 'HOME' in os.environ: + if 'HOME' in os.environ and os.name != 'nt': + # HOME is set by WinPython to something unusual, so we don't + # want that. return os.path.join(os.environ['HOME'], '.config', 'glymur') - if 'USERPROFILE' in os.environ: - # Windows? - return os.path.join(os.environ['USERPROFILE'], 'Application Data', - 'glymur') + if os.name == 'nt': + # Windows. + return os.path.join(os.path.expanduser('~'), 'glymur') From 604d7908c4ae268adaae59f2e750a373dc02e1ec Mon Sep 17 00:00:00 2001 From: John Evans Date: Fri, 26 Jul 2013 14:57:21 -0400 Subject: [PATCH 2/5] Updated windows notes for configuation file location. Closes #91. --- docs/source/detailed_installation.rst | 31 +++++++++++++++++++-------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/docs/source/detailed_installation.rst b/docs/source/detailed_installation.rst index b737843..165868f 100644 --- a/docs/source/detailed_installation.rst +++ b/docs/source/detailed_installation.rst @@ -1,5 +1,5 @@ ---------------------------------- -Detailed Installation Instructions +Advanced Installation Instructions ---------------------------------- '''''''''''''''''''''' @@ -30,8 +30,22 @@ configparser module, i.e. :: openjp2: /opt/openjp2-svn/lib/libopenjp2.so This assumes, of course, that you've installed OpenJPEG into -/opt/openjp2-svn on a linux system. You may also substitute -**$XDG_CONFIG_HOME** for **$HOME/.config**. +/opt/openjp2-svn on a linux system. The location of the configuration file +is platform-dependent (of course). If you use either linux or mac, the path +to the configuration file would normally be :: + + $HOME/.config/glymur/glymurrc + +but if you have **$XDG_CONFIG_HOME** defined, the path will be :: + + $XDG_CONFIG_HOME/glymur/glymurrc + +On windows, the path to the configuration file can be determined by starting up Python +and typing :: + + import os + os.path.join(os.path.expanduser('~'), 'glymur', 'glymurrc') + You may also include a line for the version 1.x openjpeg library if you have it installed in a non-standard place, i.e. :: @@ -124,12 +138,11 @@ In addition, you must install contextlib2 and Pillow via pip. :: Windows ------- -The only configuration I've tested is Python(xy), which uses Python 2.7. -Python(xy) already comes with numpy, but you will have to install pip and then -contextlib2 and mock as well. Glymur seems to work with both 1.5.1 and the -svn development versions of openjpeg. +I would recommend using WinPython, but Python(xy) also seems to work. WinPython 3.3 +should work with no additional installations required, but 2.7 versions still require +contextlib2 and mock to be installed via pip. -Glymur has been tested **far less** extensively on Windows than on the other +Glymur has been tested far less extensively on Windows than on the other platforms. @@ -141,7 +154,7 @@ There are two environment variables you may wish to set before running the tests. * **OPJ_DATA_ROOT** - points to directory for OpenJPEG test data - * **FORMAT_CORPUS_ROOT** - points to directory for format-corpus repository (see https://github.com/openplanets/format-corpus) + * **FORMAT_CORPUS_ROOT** - points to directory for format-corpus repository (see https://github.com/openplanets/format-corpus if you wish, but you really don't need to bother with this) Setting these two environment variables is not required, as any tests using either of them will be skipped. From c1c6080b18a6e203233be6241669ac287df8933a Mon Sep 17 00:00:00 2001 From: John Evans Date: Sat, 27 Jul 2013 19:31:24 -0400 Subject: [PATCH 3/5] Windows if-statement is now a catch-all for config file location. Closes #91, again. --- glymur/lib/config.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/glymur/lib/config.py b/glymur/lib/config.py index 21c1205..764934e 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -145,9 +145,8 @@ def get_configdir(): if 'HOME' in os.environ and os.name != 'nt': # HOME is set by WinPython to something unusual, so we don't - # want that. + # necessarily want that. return os.path.join(os.environ['HOME'], '.config', 'glymur') - if os.name == 'nt': - # Windows. - return os.path.join(os.path.expanduser('~'), 'glymur') + # Last stand. Should handle windows... others? + return os.path.join(os.path.expanduser('~'), 'glymur') From c3afd41bc8c12f9a5dbf38970f81e1e89dbb79ca Mon Sep 17 00:00:00 2001 From: John Evans Date: Sat, 27 Jul 2013 19:47:26 -0400 Subject: [PATCH 4/5] Prepping for 0.2.8 release. --- CHANGES.txt | 3 +++ docs/source/conf.py | 2 +- setup.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8461f8e..b6441a8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +Jul 27, 2013 - v0.2.8 Fixed inconsistency regarding configuration + file directory on windows (issue91). + Jul 25, 2013 - v0.2.7 Warns but no longer errors out when neither library is found (issue89). diff --git a/docs/source/conf.py b/docs/source/conf.py index b501034..0225ce8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -78,7 +78,7 @@ copyright = u'2013, John Evans' # The short X.Y version. version = '0.2' # The full version, including alpha/beta/rc tags. -release = '0.2.7' +release = '0.2.8' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 52df311..8bb2c6b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import sys kwargs = {'name': 'Glymur', - 'version': '0.2.7', + 'version': '0.2.8rc1', 'description': 'Tools for accessing JPEG2000 files', 'long_description': open('README.md').read(), 'author': 'John Evans', From cd9492ad708e1b8c5f80271c704ae816b6143ef4 Mon Sep 17 00:00:00 2001 From: jevans Date: Sat, 27 Jul 2013 20:28:45 -0400 Subject: [PATCH 5/5] Finalizing 0.2.8 release. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8bb2c6b..b611908 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import sys kwargs = {'name': 'Glymur', - 'version': '0.2.8rc1', + 'version': '0.2.8', 'description': 'Tools for accessing JPEG2000 files', 'long_description': open('README.md').read(), 'author': 'John Evans',