[xmds2] 01/02: Add patch site-wide-conf.patch
Rafael Laboissière
rlaboiss-guest at moszumanska.debian.org
Thu Jan 9 22:17:52 UTC 2014
This is an automated email from the git hooks/post-receive script.
rlaboiss-guest pushed a commit to branch site-wide-conf
in repository xmds2.
commit 97125d6c7b8c0db36041cd5f37d89a85b61e892e
Author: Rafael Laboissiere <rafael at laboissiere.net>
Date: Thu Jan 9 17:46:59 2014 +0100
Add patch site-wide-conf.patch
---
debian/patches/series | 1 +
debian/patches/site-wide-conf.patch | 108 ++++++++++++++++++++++++++++++++++++
2 files changed, 109 insertions(+)
diff --git a/debian/patches/series b/debian/patches/series
index 3cdf6c6..b8ff04e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ interpreter-name-in-shebang.patch
operator-bashism.patch
drop-dependency-on-sphinx.patch
string-quote-in-run-tests.patch
+site-wide-conf.patch
diff --git a/debian/patches/site-wide-conf.patch b/debian/patches/site-wide-conf.patch
new file mode 100644
index 0000000..aea77e8
--- /dev/null
+++ b/debian/patches/site-wide-conf.patch
@@ -0,0 +1,108 @@
+Description: Separate paths for site-wide configuration and user data files
+ XMDS recognizes now two environment variables: XMDS_CONF_DIR (defaults to
+ /etc/xmds) amd XMDS_DATA_DIR (defaults to ~/.xmds2). all the waf releated
+ files will go into XMDS_CONF_DIR, while the cache data for the user
+ (xpdeint_cache) and the wisdom file for FFTW3 will go into XMDS_DATA_DIR.
+ For backward compatibility, if the environment variable XMDS_USER_DATA
+ environment variable is set, then it is used for both purposes, regardless
+ of the existence of XMDS_CONF_DIR and XMDS_DATA_DIR.
+Author: Rafael Laboissiere <rafael at laboissiere.net>
+Last-Update: 2014-01-09
+
+--- a/xpdeint/Configuration.py
++++ b/xpdeint/Configuration.py
+@@ -25,11 +25,12 @@
+
+ from pkg_resources import resource_filename
+ from xpdeint.Preferences import xpdeintUserDataPath
++from xpdeint.Preferences import xpdeintSysConfPath
+ from xpdeint.Utilities import unique
+
+ import cPickle, tempfile, shutil, logging
+
+-config_arg_cache_filename = os.path.join(xpdeintUserDataPath, 'xpdeint_config_arg_cache')
++config_arg_cache_filename = os.path.join(xpdeintSysConfPath, 'xpdeint_config_arg_cache')
+
+ wafdir = os.path.normpath(resource_filename(__name__, 'waf'))
+ sys.path.insert(0, wafdir)
+@@ -44,8 +45,8 @@
+ Logs.init_log()
+
+ Context.waf_dir = wafdir
+- Context.top_dir = Context.run_dir = xpdeintUserDataPath
+- Context.out_dir = os.path.join(xpdeintUserDataPath, 'waf_configure')
++ Context.top_dir = Context.run_dir = xpdeintSysConfPath
++ Context.out_dir = os.path.join(xpdeintSysConfPath, 'waf_configure')
+
+ wscript_path = resource_filename(__name__, 'support/wscript')
+ Context.g_module = Context.load_module(wscript_path)
+@@ -99,13 +100,13 @@
+ except Errors.ConfigurationError as e:
+ print "Configuration failed. Address the above issue to use xmds2."
+
+- print "Config log saved to ", os.path.join(xpdeintUserDataPath, 'waf_configure', 'config.log')
++ print "Config log saved to ", os.path.join(xpdeintSysConfPath, 'waf_configure', 'config.log')
+
+ # Copy wscript file to indicate what we configured with
+ wscript_path = resource_filename(__name__, 'support/wscript')
+- wscript_userdata_path = os.path.join(xpdeintUserDataPath, 'wscript')
++ wscript_sysconf_path = os.path.join(xpdeintSysConfPath, 'wscript')
+
+- shutil.copyfile(wscript_path, wscript_userdata_path)
++ shutil.copyfile(wscript_path, wscript_sysconf_path)
+ return ret
+
+
+--- a/xpdeint/Preferences.py
++++ b/xpdeint/Preferences.py
+@@ -5,6 +5,14 @@
+ versionString = '2.1.4 "Well if this isn\'t nice, I don\'t know what is"'
+
+ if 'XMDS_USER_DATA' in os.environ:
++ xpdeintSysConfPath = os.environ['XMDS_USER_DATA']
+ xpdeintUserDataPath = os.environ['XMDS_USER_DATA']
+ else:
+- xpdeintUserDataPath = os.path.join(os.path.expanduser('~'), '.xmds')
++ if 'XMDS_CONF_DIR' in os.environ:
++ xpdeintSysConfPath = os.environ['XMDS_CONF_DIR']
++ else:
++ xpdeintSysConfPath = os.path.join("/etc", "xmds")
++ if 'XMDS_DATA_DIR' in os.environ:
++ xpdeintUserDataPath = os.environ['XMDS_DATA_DIR']
++ else:
++ xpdeintUserDataPath = os.path.join(os.path.expanduser('~'), '.xmds')
+--- a/xpdeint/parser2.py
++++ b/xpdeint/parser2.py
+@@ -38,6 +38,7 @@
+ import cPickle
+
+ from xpdeint.Preferences import xpdeintUserDataPath
++from xpdeint.Preferences import xpdeintSysConfPath
+
+ # Import the parser stuff
+ from xpdeint.ParserException import ParserException, parserWarning
+@@ -146,6 +147,8 @@
+
+ if not os.path.isdir(xpdeintUserDataPath):
+ os.mkdir(xpdeintUserDataPath)
++ if not os.path.isdir(xpdeintSysConfPath):
++ os.mkdir(xpdeintSysConfPath)
+
+ # Attempt to parse command line arguments
+ if argv is None:
+@@ -228,11 +231,11 @@
+ return 2
+
+ wscript_path = resource_filename(__name__, 'support/wscript')
+- wscript_userdata_path = os.path.join(xpdeintUserDataPath, 'wscript')
+- waf_build_cache_path = os.path.join(xpdeintUserDataPath, 'waf_configure/c4che/_cache.py')
++ wscript_sysconf_path = os.path.join(xpdeintSysConfPath, 'wscript')
++ waf_build_cache_path = os.path.join(xpdeintSysConfPath, 'waf_configure/c4che/_cache.py')
+
+- if not os.path.isfile(wscript_userdata_path) or \
+- fileContentsHash(wscript_userdata_path) != fileContentsHash(wscript_path) or \
++ if not os.path.isfile(wscript_sysconf_path) or \
++ fileContentsHash(wscript_sysconf_path) != fileContentsHash(wscript_path) or \
+ not os.path.exists(waf_build_cache_path):
+ print "Reconfiguring xmds2 (updated config script)..."
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/xmds2.git
More information about the debian-science-commits
mailing list