Commits

Martin von Löwis  committed 98048d2

Allow to run the scripts out of the source directory again.

  • Participants
  • Parent commits e4e5ebf

Comments (0)

Files changed (2)

File scripts/pep381run

 #!/usr/bin/env python
 import sys, os, shutil, optparse
-import pep381client
+try:
+    import pep381client
+except ImportError:
+    # See whether we are run out of a source tree
+    module_path = os.path.join(os.path.dirname(sys.argv[0]), 
+                               '..', 'pep381client')
+    if os.path.exists(module_path):
+        sys.path.extend(module_path)
+    import pep381client
 
 opts = optparse.OptionParser(usage="Usage: pep381run [OPTIONS] <targetdir>")
 opts.add_option("-q", "--quiet", dest="quiet", action="store_true", default=False,
 try:
     state.synchronize()
 except KeyboardInterrupt:
-    print "\nMirroring paused. Resume by restarting pep381run."
+    print "\nMirroring paused. Resume by restarting pep381run."

File scripts/processlogs

 # Generates download stats for all days in the given log files,
 # except for the oldest and the newest day.
 import sys, os, csv
+# See whether we are run out of a source tree
+module_path = os.path.join(os.path.dirname(sys.argv[0]), 
+                           '..', 'pep381client')
+if os.path.exists(module_path):
+    sys.path.extend(module_path)
 from pep381client import apache_reader, apache_stats
 
 def usage(msg=None):