Martin von Löwis avatar Martin von Löwis committed 6388b78

Fix various bugs.

Comments (0)

Files changed (1)

scripts/pep381checkfiles

     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())
+    try:
+        f = open(os.path.join(dir, 'index.html'))
+    except IOError:
+        print "Missing index.html for", dir
+        incomplete_packages.add(package)
+        continue
+    tree = ElementTree.fromstring(f.read())
     for a in tree.findall(".//a"):
         url = a.attrib['href']
         if not url.startswith('../../packages/'):
             incomplete_packages.add(package)
             print "Missing file", fn
             continue
-        if "md5="+hashlib.md5(open(fn,'rb').read()).hexdigest() != md5:
-            print "Bad md5", fn
-            continue
+        #if "md5="+hashlib.md5(open(fn,'rb').read()).hexdigest() != md5:
+        #    print "Bad md5", fn
+        #    continue
 
 if incomplete_packages:
-    s = pep381client.load(targetdir)
+    s = pep381client.Synchronization.load(targetdir)
     for i in range(10):
         if s.storage.find_running():
             print "Synchronization in progress, waiting"
             time.sleep(10)
         else:
             break
-    s.storage.start_running()
+    s.storage.start_running(os.getpid())
     s.storage.commit()
-    # Reload pickled state
-    s = pep381client.load(targetdir)
-    s.projects_to_do += incomplete_packages
-    # claim that a synchronization was aborted and 
-    # needs to be restarted
-    s.last_started = s.last_completed
-    s.store()
+    try:
+        # Reload pickled state
+        s = pep381client.Synchronization.load(targetdir)
+        s.projects_to_do.update(incomplete_packages)
+        # claim that a synchronization was aborted and 
+        # needs to be restarted
+        s.last_started = s.last_completed
+        s.store()
+    finally:
+        s.storage.end_running()
+        s.storage.commit()
     print "Todo list updated; run pep381run now"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.