Commit defc7e46 authored by Julian Andres Klode's avatar Julian Andres Klode

utils/doclint.py: Drop, not working anymore.

Sphinx changed its pickle format some time ago, so this script
does not work anymore
parent e8a92cc4
#!/usr/bin/python
# Documentation lint.
# Copyright (C) 2009 Julian Andres Klode <jak@debian.org>
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
#
# This comes without any warranty.
"""Read the pickle file created by sphinx and check it."""
from __future__ import with_statement
import cPickle
import os
import sys
def handle(filename):
with open(filename) as fobj:
index = cPickle.load(fobj)
objects = index['descrefs']
modules = index['modules']
types = index['desctypes']
for modname in modules:
module = __import__(modname, fromlist=["*"])
for modmember in objects[modname]:
if not modmember in module.__dict__:
print 'W: Unknown', modname + '.' + modmember
elif types[objects[modname][modmember][1]] == u'class':
if modname + '.' + modmember not in objects:
print 'I: No members', modname + '.' + modmember
continue
for member in objects.get(modname + '.' + modmember):
if not member in dir(module.__dict__[modmember]):
print ('W: Unknown', modname + '.' + modmember +
'.' + member)
t = types[objects[modname + "." + modmember][member][1]]
assert(t in ('method', 'attribute'))
all = getattr(module, '__all__', [])
for modmember in dir(module):
if (getattr(module.__dict__[modmember], "__module__", modname) !=
modname):
continue
if isinstance(module.__dict__[modmember], type(module)):
continue
if modmember.startswith("_"):
continue
if (not modmember in objects[modname] and
(not all or modmember in all)):
print 'E: Missing', modname + '.' + modmember
elif not modmember in objects[modname]:
print 'W: Missing', modname + '.' + modmember
elif types[objects[modname][modmember][1]] == u'class':
for member in dir(module.__dict__[modmember]):
if member.startswith("_"):
continue
try:
contin = False
for base in module.__dict__[modmember].__bases__:
if member in dir(base):
contin = True
if contin:
continue
except:
pass
if not member in objects.get(
modname + '.' + modmember, ""):
print('E: Missing', modname + '.' + modmember + '.' +
member)
if __name__ == '__main__':
scriptdir = os.path.dirname(__file__)
parentdir = os.path.join(scriptdir, "..")
directory = os.path.join(parentdir, "doc", "build", "pickle")
directory = os.path.normpath(directory)
sys.path.insert(0, os.path.abspath(parentdir))
handle(os.path.join(directory, "searchindex.pickle"))
#!/usr/bin/env python
import threading, Queue, time, re, os, tempfile
#!/usr/bin/env python3
import threading, queue, time, re, os, tempfile
import aptsources.sourceslist
import aptsources.distro
from timeit import Timer
import urllib
import urllib.request, urllib.parse, urllib.error
import socket
import random
socket.setdefaulttimeout(2)
......@@ -24,9 +24,9 @@ class MirrorTest:
host = mirror.hostname
except:
continue
print "Pinging (Worker %s) %s (%s) ..." % (self.id,
print("Pinging (Worker %s) %s (%s) ..." % (self.id,
host,
MirrorTest.completed_pings)
MirrorTest.completed_pings))
commando = os.popen("ping -q -c 4 -W 2 -i 0.3 %s" % host,
"r")
while True:
......@@ -43,17 +43,17 @@ class MirrorTest:
def speed_test(self, mirror):
url = "%s/%s" % (mirror.get_repo_urls()[0],
self.test_file)
print "Downloading %s ..." % url
print("Downloading %s ..." % url)
start = time.time()
try:
data = urllib.urlopen(url).read(51200)
data = urllib.request.urlopen(url).read(51200)
return 50 / (time.time() - start)
except:
return 0
def __init__(self, hosts, test_file):
self.test_file = test_file
jobs = Queue.Queue()
jobs = queue.Queue()
results = []
for h in hosts:
jobs.put(h)
......@@ -71,21 +71,20 @@ class MirrorTest:
t.join()
results.sort()
print "\n\nTop ten RTTs:"
print("\n\nTop ten RTTs:")
for r in results[0:10]:
print "%s: %s" % (r[1], r[0])
print "\n\n"
print("%s: %s" % (r[1], r[0]))
print("\n\n")
results.insert(0, [0, "rand", hosts[random.randint(1, len(hosts))]])
results.insert(0, [0, "rand", hosts[random.randint(1, len(hosts))]])
final = map(lambda r: (self.speed_test(r[2]), r[2]),
results[0:12])
final = [(self.speed_test(r[2]), r[2]) for r in results[0:12]]
final.sort()
final.reverse()
print "\n\nBest mirrors:"
print("\n\nBest mirrors:")
for f in final:
print "%s: %s KByte/s" % (f[1].hostname, int(f[0]))
print("%s: %s KByte/s" % (f[1].hostname, int(f[0])))
if __name__ == "__main__":
distro = aptsources.distro.get_distro()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment