[PATCH] Remove setup_path.py.

Nathaniel Smith njs at pobox.com
Sun Aug 10 22:19:18 UTC 2003


Ding-dong, the file is dead, and all that.  With this patch, one still
has to set QM_HOME and optionally QM_BUILD before loading the qm
modules, but that's incremental for you.

-- Nathaniel

-- 
"...these, like all words, have single, decontextualized meanings: everyone
knows what each of these words means, everyone knows what constitutes an
instance of each of their referents.  Language is fixed.  Meaning is
certain.  Santa Claus comes down the chimney at midnight on December 24."
  -- The Language War, Robin Lakoff
-------------- next part --------------
diff -urN --exclude='*~' --exclude='.*' --exclude=CVS --exclude='*.pyo' --exclude='*.pyc' --exclude=build --exclude=GNUmakefile --exclude=config.log --exclude=config.status --exclude=config.cache --exclude=qm.sh --exclude=qmtest --exclude=qm.spec --exclude='*.dtd' --exclude=CATALOG --exclude=thread_target --exclude=process_target qm-clean/ChangeLog qm-remove-setup_path.py/ChangeLog
--- qm-clean/ChangeLog	2003-08-10 14:35:34.000000000 -0700
+++ qm-remove-setup_path.py/ChangeLog	2003-08-10 14:40:48.000000000 -0700
@@ -1,4 +1,16 @@
 2003-08-10  Nathaniel Smith  <njs at codesourcery.com>
+
+	* qm/common.py (get_lib_directory): Remove.
+	(get_share_directory): Move path lookup logic to here from
+	setup_path.py.  Clarify docstring.
+	(get_doc_directory): Move path lookup logic to here from
+	setup_path.py.  Clarify docstring.
+	* qm/setup_path.py: Remove file.
+	* qm/test/qmtest.py: Don't execfile setup_path.py.
+	* GNUmakefile.in ($(SCRIPTS)): Don't set QM_TRUE_LIBDIR.
+	* qm/qm.sh: Don't set QM_TRUE_LIBDIR.
+	
+2003-08-10  Nathaniel Smith  <njs at codesourcery.com>
 	
 	* qm/version.py.in: Rename to...
 	* qm/__version.py.in: ...this.
diff -urN --exclude='*~' --exclude='.*' --exclude=CVS --exclude='*.pyo' --exclude='*.pyc' --exclude=build --exclude=GNUmakefile --exclude=config.log --exclude=config.status --exclude=config.cache --exclude=qm.sh --exclude=qmtest --exclude=qm.spec --exclude='*.dtd' --exclude=CATALOG --exclude=thread_target --exclude=process_target qm-clean/GNUmakefile.in qm-remove-setup_path.py/GNUmakefile.in
--- qm-clean/GNUmakefile.in	2003-08-10 14:35:34.000000000 -0700
+++ qm-remove-setup_path.py/GNUmakefile.in	2003-08-10 14:36:49.000000000 -0700
@@ -172,7 +172,6 @@
 	echo -e "@echo off\r" > $@
 	echo -e "set QM_HOME=C:\\progra~1\qm\r" >> $@
 	echo -e "set QM_BUILD=0\r" >> $@
-	echo -e "set QM_TRUE_LIBDIR=%QM_HOME%\\$(RELLIBDIR)\\qm\r" >> $@
 	echo -e "set PYTHONPATH=%C:\\Program Files\\QM\\$(RELLIBDIR);%PYTHONPATH%\r" >> $@
 	echo -n "$(PYTHONEXE)" \
                  \"%QM_HOME%\\$(RELLIBDIR)\\$(subst /,\\,$(basename $@)).py\" \
diff -urN --exclude='*~' --exclude='.*' --exclude=CVS --exclude='*.pyo' --exclude='*.pyc' --exclude=build --exclude=GNUmakefile --exclude=config.log --exclude=config.status --exclude=config.cache --exclude=qm.sh --exclude=qmtest --exclude=qm.spec --exclude='*.dtd' --exclude=CATALOG --exclude=thread_target --exclude=process_target qm-clean/qm/common.py qm-remove-setup_path.py/qm/common.py
--- qm-clean/qm/common.py	2003-07-03 12:32:04.000000000 -0700
+++ qm-remove-setup_path.py/qm/common.py	2003-08-10 02:26:53.000000000 -0700
@@ -219,25 +219,24 @@
 # functions
 ########################################################################
 
-def get_lib_directory(*components):
-    """Return the absolute path to the top QM Python directory."""
-
-    path = os.environ["QM_LIB_PATH"]
-    return apply(os.path.join, (path, ) + components)
-
-
 def get_share_directory(*components):
-    """Return the path to the directory containing QM data files."""
+    """Return the path to a file in the QM data file directory."""
 
-    path = os.environ["QM_SHARE_PATH"]
-    return apply(os.path.join, (path, ) + components)
+    home_dir = os.environ["QM_HOME"]
+    if os.environ.get("QM_BUILD") == "1":
+        return os.path.join(home_dir, "share", *components)
+    else:
+        return os.path.join(home_dir, "share", "qm", *components)
 
 
 def get_doc_directory(*components):
-    """Return the path to the directory containing QM documentation files."""
+    """Return a path to a file in the QM documentation file directory."""
 
-    path = os.environ["QM_DOC_PATH"]
-    return apply(os.path.join, (path, ) + components)
+    home_dir = os.environ["QM_HOME"]
+    if os.environ.get("QM_BUILD") == "1":
+        return os.path.join(home_dir, "qm", *components)
+    else:
+        return os.path.join(home_dir, "share", "doc", "qm", *components)
 
 
 def format_exception(exc_info):
diff -urN --exclude='*~' --exclude='.*' --exclude=CVS --exclude='*.pyo' --exclude='*.pyc' --exclude=build --exclude=GNUmakefile --exclude=config.log --exclude=config.status --exclude=config.cache --exclude=qm.sh --exclude=qmtest --exclude=qm.spec --exclude='*.dtd' --exclude=CATALOG --exclude=thread_target --exclude=process_target qm-clean/qm/setup_path.py qm-remove-setup_path.py/qm/setup_path.py
--- qm-clean/qm/setup_path.py	2003-08-10 13:57:14.000000000 -0700
+++ qm-remove-setup_path.py/qm/setup_path.py	1969-12-31 16:00:00.000000000 -0800
@@ -1,50 +0,0 @@
-########################################################################
-#
-# File:   setup_path.py
-# Author: Alex Samuel
-# Date:   2001-02-08
-#
-# Contents:
-#   Python fragment to set up the Python lookup path to find QM modules.
-#
-# Copyright (c) 2001, 2002 by CodeSourcery, LLC.  All rights reserved. 
-#
-# For license terms see the file COPYING.
-#
-########################################################################
-
-########################################################################
-# imports
-########################################################################
-
-import string
-import sys
-import os.path
-
-########################################################################
-# script
-########################################################################
-
-# The root of the QM installation.
-__home_dir = os.environ['QM_HOME']
-
-if os.environ['QM_BUILD'] == '1':
-    __lib_dir = __home_dir
-    __share_dir = os.path.join(__home_dir, 'share')
-    __doc_dir = os.path.join(__home_dir, 'qm')
-else:
-    __lib_dir = os.path.join(__home_dir, 'lib/qm')
-    __share_dir = os.path.join(__home_dir, 'share/qm')
-    __doc_dir = os.path.join(__home_dir, 'share/doc/qm')
-
-# Now store the QM directories in the environment, so that other modules
-# can access them.
-os.environ["QM_LIB_PATH"] = os.path.normpath(__lib_dir)
-os.environ["QM_SHARE_PATH"] = os.path.normpath(__share_dir)
-os.environ["QM_DOC_PATH"] = os.path.normpath(__doc_dir)
-
-#######################################################################
-# Local Variables:
-# mode: python
-# indent-tabs-mode: nil
-# End:
diff -urN --exclude='*~' --exclude='.*' --exclude=CVS --exclude='*.pyo' --exclude='*.pyc' --exclude=build --exclude=GNUmakefile --exclude=config.log --exclude=config.status --exclude=config.cache --exclude=qm.sh --exclude=qmtest --exclude=qm.spec --exclude='*.dtd' --exclude=CATALOG --exclude=thread_target --exclude=process_target qm-clean/qm/test/qmtest.py qm-remove-setup_path.py/qm/test/qmtest.py
--- qm-clean/qm/test/qmtest.py	2003-08-10 13:57:14.000000000 -0700
+++ qm-remove-setup_path.py/qm/test/qmtest.py	2003-08-10 14:35:56.000000000 -0700
@@ -27,8 +27,6 @@
 # the same name.
 sys.path = sys.path[1:]
 
-execfile(os.path.join(os.environ["QM_TRUE_LIBDIR"], "setup_path.py"))
-
 ########################################################################
 # imports
 ########################################################################
Binary files qm-clean/results.qmr and qm-remove-setup_path.py/results.qmr differ


More information about the qmtest mailing list