Commits

Martin von Löwis committed a64c72e

Rename checkfiles script.

  • Participants
  • Parent commits 27bfef8

Comments (0)

Files changed (3)

File scripts/checkfiles.py

-#!/usr/bin/env python
-import sys, os, shutil, optparse
-from xml.etree import ElementTree
-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]), 
-                               '..')
-    if os.path.exists(module_path):
-        sys.path.append(module_path)
-    import pep381client
-
-opts = optparse.OptionParser(usage="Usage: pep381checkfiles <targetdir>")
-options, args = opts.parse_args()
-
-if len(args) != 1:
-    opts.error("You have to specify a target directory")
-
-targetdir = args[0]
-for package in os.listdir(os.path.join(targetdir, 'web', 'simple')):
-    dir = os.path.join(targetdir, 'web', 'simple', package)
-    if not os.path.isdir(dir):
-        continue
-    tree = ElementTree.fromstring(open(os.path.join(dir, 'index.html')).read())
-    for a in tree.findall(".//a"):
-        url = a.attrib['href']
-        if not url.startswith('../../packages/'):
-            continue
-        url, md5 = url.split('#')
-        url = url[len('../..'):]
-        fn = os.path.join(targetdir, 'web', url)
-        if not os.path.exists(fn):
-            print "Missing file", fn
-            continue
-        if "md5="+hashlib.md5(open(fn,'b').read()) != md5:
-            print "Bad md5", fn
-            continue
-    

File scripts/pep381checkfiles

+#!/usr/bin/env python
+import sys, os, shutil, optparse
+from xml.etree import ElementTree
+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]), 
+                               '..')
+    if os.path.exists(module_path):
+        sys.path.append(module_path)
+    import pep381client
+
+opts = optparse.OptionParser(usage="Usage: pep381checkfiles <targetdir>")
+options, args = opts.parse_args()
+
+if len(args) != 1:
+    opts.error("You have to specify a target directory")
+
+targetdir = args[0]
+for package in os.listdir(os.path.join(targetdir, 'web', 'simple')):
+    dir = os.path.join(targetdir, 'web', 'simple', package)
+    if not os.path.isdir(dir):
+        continue
+    tree = ElementTree.fromstring(open(os.path.join(dir, 'index.html')).read())
+    for a in tree.findall(".//a"):
+        url = a.attrib['href']
+        if not url.startswith('../../packages/'):
+            continue
+        url, md5 = url.split('#')
+        url = url[len('../..'):]
+        fn = os.path.join(targetdir, 'web', url)
+        if not os.path.exists(fn):
+            print "Missing file", fn
+            continue
+        if "md5="+hashlib.md5(open(fn,'b').read()) != md5:
+            print "Bad md5", fn
+            continue
+    
       license = 'Academic Free License, version 3',
       url='http://bitbucket.org/loewis/pep381client/',
       packages=['pep381client'],
-      scripts=['scripts/pep381run', 'scripts/processlogs']
+      scripts=['scripts/pep381run', 'scripts/processlogs', 'scripts/pep381checkfiles']
      )