chore: remove unused scipts from ietf/bin (#6259)
This commit is contained in:
parent
b5bf6789da
commit
f2dc32a310
|
@ -1,296 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os, re, sys, shutil, pathlib
|
||||
from collections import namedtuple
|
||||
from PIL import Image
|
||||
|
||||
# boilerplate
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.text import slugify
|
||||
|
||||
import debug
|
||||
|
||||
from ietf.group.models import Role, Person
|
||||
from ietf.person.name import name_parts
|
||||
|
||||
old_images_dir = ''
|
||||
new_images_dir = settings.PHOTOS_DIR
|
||||
|
||||
if not os.path.exists(new_images_dir):
|
||||
print("New images directory does not exist: %s" % new_images_dir)
|
||||
sys.exit(1)
|
||||
|
||||
old_image_files = []
|
||||
for dir in settings.OLD_PHOTO_DIRS:
|
||||
if not os.path.exists(dir):
|
||||
print("Old images directory does not exist: %s" % dir)
|
||||
sys.exit(1)
|
||||
old_image_files += [ f for f in pathlib.Path(dir).iterdir() if f.is_file() and f.suffix.lower() in ['.jpg', '.jpeg', '.png'] ]
|
||||
|
||||
photo = namedtuple('photo', ['path', 'name', 'ext', 'width', 'height', 'time', 'file'])
|
||||
|
||||
old_images = []
|
||||
for f in old_image_files:
|
||||
path = str(f)
|
||||
img = Image.open(path)
|
||||
old_images.append(photo(path, f.stem.decode('utf8'), f.suffix, img.size[0], img.size[1], f.stat().st_mtime, f))
|
||||
|
||||
# Fix up some names:
|
||||
|
||||
def fix_missing_surnames(images):
|
||||
replacement = {
|
||||
"alissa": "alissa-cooper",
|
||||
"alissa1": "alissa-cooper",
|
||||
"andrei": "andrei-robachevsky",
|
||||
"bernard": "bernard-aboba",
|
||||
"danny": "danny-mcpherson",
|
||||
"danny1": "danny-mcpherson",
|
||||
"dthaler": "dave-thaler",
|
||||
"eliot-mug": "eliot-lear",
|
||||
"erik.nordmark-300": "erik-nordmark",
|
||||
"hannes": "hannes-tschofenig",
|
||||
"hildebrand": "joe-hildebrand",
|
||||
"housley": "russ-housley",
|
||||
"jariarkko": "jari-arkko",
|
||||
"joel": "joel-jaeggli",
|
||||
"joel1": "joel-jaeggli",
|
||||
"joel2": "joel-jaeggli",
|
||||
"jon": "jon-peterson",
|
||||
"kessens": "david-kessens",
|
||||
"klensin": "john-klensin",
|
||||
"lars": "lars-eggert",
|
||||
"lars1": "lars-eggert",
|
||||
"marc_blanchet": "marc-blanchet",
|
||||
"marcelo": "marcelo-bagnulo",
|
||||
"olaf": "olaf-kolkman",
|
||||
"olaf1": "olaf-kolkman",
|
||||
"ross": "ross-callon",
|
||||
"spencer": "spencer-dawkins",
|
||||
"spencer1": "spencer-dawkins",
|
||||
"vijay": "vijay-gurbani",
|
||||
"xing": "xing-li",
|
||||
}
|
||||
|
||||
for i in range(len(images)):
|
||||
img = images[i]
|
||||
name = re.sub('-[0-9]+x[0-9]+', '', img.name)
|
||||
if '/iab/' in img.path and name in replacement:
|
||||
name = replacement[name]
|
||||
images[i] = photo(img.path, name, img.ext, img.width, img.height, img.time, img.file)
|
||||
|
||||
|
||||
fix_missing_surnames(old_images)
|
||||
|
||||
interesting_persons = set(Person.objects.all())
|
||||
|
||||
name_alias = {
|
||||
u"andy": [u"andrew", ],
|
||||
u"ben": [u"benjamin", ],
|
||||
u"bill": [u"william", ],
|
||||
u"bob": [u"robert", ],
|
||||
u"chris": [u"christopher", u"christian"],
|
||||
u"dan": [u"daniel", ],
|
||||
u"dave": [u"david", ],
|
||||
u"dick": [u"richard", ],
|
||||
u"fred": [u"alfred", ],
|
||||
u"geoff": [u"geoffrey", ],
|
||||
u"jake": [u"jacob", ],
|
||||
u"jerry": [u"gerald", ],
|
||||
u"jim": [u"james", ],
|
||||
u"joe": [u"joseph", ],
|
||||
u"jon": [u"jonathan", ],
|
||||
u"mike": [u"michael", ],
|
||||
u"ned": [u"edward", ],
|
||||
u"pete": [u"peter", ],
|
||||
u"ron": [u"ronald", ],
|
||||
u"russ": [u"russel", ],
|
||||
u"steve": [u"stephen", ],
|
||||
u"ted": [u"edward", ],
|
||||
u"terry": [u"terence", ],
|
||||
u"tom": [u"thomas", ],
|
||||
u"wes": [u"wesley", ],
|
||||
u"will": [u"william", ],
|
||||
|
||||
u"beth": [u"elizabeth", ],
|
||||
u"liz": [u"elizabeth", ],
|
||||
u"lynn": [u"carolyn", ],
|
||||
u"pat": [u"patricia", u"patrick", ],
|
||||
u"sue": [u"susan", ],
|
||||
}
|
||||
# Add lookups from long to short, from the initial set
|
||||
for key,value in name_alias.items():
|
||||
for item in value:
|
||||
if item in name_alias:
|
||||
name_alias[item] += [ key ];
|
||||
else:
|
||||
name_alias[item] = [ key ];
|
||||
|
||||
exceptions = {
|
||||
'Aboba' : 'aboba-bernard',
|
||||
'Bernardos' : 'cano-carlos',
|
||||
'Bormann' : 'bormann-carsten',
|
||||
'Hinden' : 'hinden-bob',
|
||||
'Hutton' : 'hutton-andy',
|
||||
'Narten' : 'narten-thomas', # but there's no picture of him
|
||||
'O\'Donoghue' : 'odonoghue-karen',
|
||||
'Przygienda' : 'przygienda-antoni',
|
||||
'Salowey' : 'salowey-joe',
|
||||
'Gunter Van de Velde' : 'vandevelde-gunter',
|
||||
'Eric Vyncke' : 'vynke-eric',
|
||||
'Zuniga' : 'zuniga-carlos-juan',
|
||||
'Zhen Cao' : 'zhen-cao',
|
||||
'Jamal Hadi Salim': 'hadi-salim-jamal',
|
||||
}
|
||||
|
||||
# Manually copied Bo Burman and Thubert Pascal from wg/photos/
|
||||
# Manually copied Victor Pascual (main image, not thumb) from wg/
|
||||
# Manually copied Eric Vync?ke (main image, not thumb) from wg/photos/
|
||||
# Manually copied Danial King (main image, not thumb) from wg/photos/
|
||||
# Manually copied the thumb (not labelled as such) for Tianran Zhou as both the main and thumb image from wg/photos/
|
||||
|
||||
processed_files = []
|
||||
|
||||
for person in sorted(list(interesting_persons),key=lambda x:x.last_name()+x.ascii):
|
||||
substr_pattern = None
|
||||
for exception in exceptions:
|
||||
if exception in person.ascii:
|
||||
substr_pattern = exceptions[exception]
|
||||
break
|
||||
if not person.ascii.strip():
|
||||
print(" Setting person.ascii for %s" % person.name)
|
||||
person.ascii = person.name.encode('ascii', errors='replace').decode('ascii')
|
||||
|
||||
_, first, _, last, _ = person.ascii_parts()
|
||||
first = first.lower()
|
||||
last = last. lower()
|
||||
if not substr_pattern:
|
||||
substr_pattern = slugify("%s %s" % (last, first))
|
||||
|
||||
if first in ['', '<>'] or last in ['', '<>']:
|
||||
continue
|
||||
|
||||
#debug.show('1, substr_pattern')
|
||||
|
||||
candidates = [x for x in old_images if x.name.lower().startswith(substr_pattern)]
|
||||
# Also check the reverse the name order (necessary for Deng Hui, for instance)
|
||||
substr_pattern = slugify("%s %s" % (first, last))
|
||||
#debug.show('2, substr_pattern')
|
||||
prev_len = len(candidates)
|
||||
candidates += [x for x in old_images if x.name.lower().startswith(substr_pattern)]
|
||||
if prev_len < len(candidates) :
|
||||
print(" Found match with '%s %s' for '%s %s'" % (last, first, first, last, ))
|
||||
# If no joy, try a short name
|
||||
if first in name_alias:
|
||||
prev_len = len(candidates)
|
||||
for alias in name_alias[first]:
|
||||
substr_pattern = slugify("%s %s" % (last, alias))
|
||||
#debug.show('3, substr_pattern')
|
||||
candidates += [x for x in old_images if x.name.lower().startswith(substr_pattern)]
|
||||
if prev_len < len(candidates):
|
||||
print(" Found match with '%s %s' for '%s %s'" % (alias, last, first, last, ))
|
||||
|
||||
|
||||
# # If still no joy, try with Person.plain_name() (necessary for Donald Eastlake)
|
||||
# if not candidates:
|
||||
# prefix, first, middle, last, suffix = person.name_parts()
|
||||
# name_parts = person.plain_name().lower().split()
|
||||
#
|
||||
# substr_pattern = u'-'.join(name_parts[-1:]+name_parts[0:1])
|
||||
# candidates = [x for x in old_images if x.name.lower().startswith(substr_pattern)]
|
||||
# # If no joy, try a short name
|
||||
# if not candidates and first in name_alias:
|
||||
# prev_len = len(candidates)
|
||||
# for alias in name_alias[first]:
|
||||
# substr_pattern = u'-'.join(name_parts[-1:]+[alias])
|
||||
# candidates += [x for x in old_images if x.name.lower().startswith(substr_pattern)]
|
||||
# if prev_len < len(candidates) :
|
||||
# print(" Used '%s %s' instead of '%s %s'" % (alias, last, first, last, ))
|
||||
|
||||
# # Fixup for other exceptional cases
|
||||
# if person.ascii=="David Oran":
|
||||
# candidates = ['oran-dave-th.jpg','oran-david.jpg']
|
||||
#
|
||||
# if person.ascii=="Susan Hares":
|
||||
# candidates = ['hares-sue-th.jpg','hares-susan.JPG']
|
||||
#
|
||||
# if person.ascii=="Mahesh Jethanandani":
|
||||
# candidates = ['Mahesh-Jethanandani-th.jpg','Jethanandani-Mahesh.jpg']
|
||||
|
||||
processed_files += [ c.path for c in candidates ]
|
||||
|
||||
# We now have a list of candidate photos.
|
||||
# * Consider anything less than 200x200 a thumbnail
|
||||
# * For the full photo, sort by size (width) and time
|
||||
# * For the thumbnail:
|
||||
# - first look for a square photo less than 200x200
|
||||
# - if none found, then for the first in the sorted list less than 200x200
|
||||
# - if none found, then the smallest photo
|
||||
if candidates:
|
||||
candidates.sort(key=lambda x: "%04d-%d" % (x.width, x.time))
|
||||
iesg_cand = [ c for c in candidates if '/iesg/' in c.path ]
|
||||
iab_cand = [ c for c in candidates if '/iab/' in c.path ]
|
||||
if iesg_cand:
|
||||
full = iesg_cand[-1]
|
||||
thumb = iesg_cand[-1]
|
||||
elif iab_cand:
|
||||
full = iab_cand[-1]
|
||||
thumb = iab_cand[0]
|
||||
else:
|
||||
full = candidates[-1]
|
||||
thumbs = [ c for c in candidates if c.width==c.height and c.width <= 200 ]
|
||||
if not thumbs:
|
||||
thumbs = [ c for c in candidates if c.width==c.height ]
|
||||
if not thumbs:
|
||||
thumbs = [ c for c in candidates if c.width <= 200 ]
|
||||
if not thumbs:
|
||||
thumbs = candidates[:1]
|
||||
thumb = thumbs[-1]
|
||||
candidates = [ thumb, full ]
|
||||
|
||||
# At this point we either have no candidates or two. If two, the first will be the thumb
|
||||
|
||||
def copy(old, new):
|
||||
if not os.path.exists(new):
|
||||
print("Copying "+old+" to "+new)
|
||||
shutil.copy(old, new)
|
||||
shutil.copystat(old, new)
|
||||
|
||||
assert(len(candidates) in [0,2])
|
||||
if len(candidates)==2:
|
||||
thumb, full = candidates
|
||||
|
||||
new_name = person.photo_name(thumb=False)+full.ext.lower()
|
||||
new_thumb_name = person.photo_name(thumb=True)+thumb.ext.lower()
|
||||
|
||||
copy( full.path, os.path.join(new_images_dir,new_name) )
|
||||
|
||||
#
|
||||
copy( thumb.path, os.path.join(new_images_dir,new_thumb_name) )
|
||||
|
||||
|
||||
print("")
|
||||
not_processed = 0
|
||||
for file in old_image_files:
|
||||
if ( file.is_file()
|
||||
and not file.suffix.lower() in ['.txt', '.lck', '.html',]
|
||||
and not file.name.startswith('index.')
|
||||
and not file.name.startswith('milestoneupdate')
|
||||
and not file.name.startswith('nopicture')
|
||||
and not file.name.startswith('robots.txt')
|
||||
):
|
||||
if not str(file).decode('utf8') in processed_files:
|
||||
not_processed += 1
|
||||
print(u"Not processed: "+str(file).decode('utf8'))
|
||||
print("")
|
||||
print("Not processed: %s files" % not_processed)
|
|
@ -1,48 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys, os, sys
|
||||
import datetime
|
||||
|
||||
# boilerplate
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from django.core import management
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
from ietf import settings
|
||||
from ietf.utils.mail import send_mail_preformatted
|
||||
from ietf.utils.mail import send_mail
|
||||
|
||||
target_date=datetime.date(year=2014,month=1,day=24)
|
||||
|
||||
send_mail(request = None,
|
||||
to = "IETF-Announce <ietf-announce@ietf.org>",
|
||||
frm = "The IESG <iesg-secretary@ietf.org>",
|
||||
subject = "Upcoming change to announcement email header fields (using old header)",
|
||||
template = "utils/header_change_content.txt",
|
||||
context = dict(oldornew='old', target_date=target_date),
|
||||
extra = {'Reply-To' : 'ietf@ietf.org',
|
||||
'Sender' : '<iesg-secretary@ietf.org>',
|
||||
}
|
||||
)
|
||||
|
||||
send_mail(request = None,
|
||||
to = "IETF-Announce:;",
|
||||
frm = "The IESG <noreply@ietf.org>",
|
||||
subject = "Upcoming change to announcement email header fields (using new header)",
|
||||
template = "utils/header_change_content.txt",
|
||||
context = dict(oldornew='new', target_date=target_date),
|
||||
extra = {'Reply-To' : 'IETF Discussion List <ietf@ietf.org>',
|
||||
'Sender' : '<iesg-secretary@ietf.org>',
|
||||
},
|
||||
bcc = '<ietf-announce@ietf.org>',
|
||||
)
|
|
@ -1,43 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- Python -*-
|
||||
#
|
||||
|
||||
import os, sys
|
||||
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from ietf.group.models import Group
|
||||
from ietf.person.models import Person
|
||||
from ietf.name.models import SessionStatusName
|
||||
from ietf.meeting.models import Meeting, Session, ScheduledSession as ScheduleTimeslotSSessionAssignment
|
||||
|
||||
secretariat = Group.objects.get(acronym='secretariat')
|
||||
system = Person.objects.get(id=1, name='(System)')
|
||||
scheduled = SessionStatusName.objects.get(slug='sched')
|
||||
|
||||
for meeting in Meeting.objects.filter(type="ietf").order_by("date"):
|
||||
print "Checking %s schedules ..." % meeting
|
||||
brk, __ = Session.objects.get_or_create(meeting=meeting, group=secretariat, requested_by=system, status=scheduled, name='Break', type_id='break',)
|
||||
reg, __ = Session.objects.get_or_create(meeting=meeting, group=secretariat, requested_by=system, status=scheduled, name='Registration', type_id='reg',)
|
||||
|
||||
for schedule in meeting.schedule_set.all():
|
||||
print " Checking for missing Break and Reg sessions in %s" % schedule
|
||||
for timeslot in meeting.timeslot_set.all():
|
||||
if timeslot.type_id == 'break' and not (schedule.base and SchedTimeSessAssignment.objects.filter(timeslot=timeslot, session=brk, schedule=schedule.base).exists()):
|
||||
assignment, created = SchedTimeSessAssignment.objects.get_or_create(timeslot=timeslot, session=brk, schedule=schedule)
|
||||
if created:
|
||||
print " Added %s break assignment" % timeslot
|
||||
if timeslot.type_id == 'reg' and not (schedule.base and SchedTimeSessAssignment.objects.filter(timeslot=timeslot, session=reg, schedule=schedule.base).exists()):
|
||||
assignment, created = SchedTimeSessAssignment.objects.get_or_create(timeslot=timeslot, session=reg, schedule=schedule)
|
||||
if created:
|
||||
print " Added %s registration assignment" % timeslot
|
|
@ -1,72 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
version = "0.10"
|
||||
program = os.path.basename(sys.argv[0])
|
||||
progdir = os.path.dirname(sys.argv[0])
|
||||
|
||||
# boilerplate
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def note(string):
|
||||
sys.stdout.write("%s\n" % (string))
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def warn(string):
|
||||
sys.stderr.write(" * %s\n" % (string))
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
import re
|
||||
import datetime
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from ietf.utils.path import path as Path
|
||||
from ietf.doc.models import Document, NewRevisionDocEvent
|
||||
from ietf.person.models import Person
|
||||
|
||||
system_entity = Person.objects.get(name="(System)")
|
||||
|
||||
charterdir = Path(settings.CHARTER_PATH)
|
||||
for file in charterdir.files("charter-ietf-*.txt"):
|
||||
fname = file.name
|
||||
ftime = datetime.datetime.fromtimestamp(file.mtime, datetime.timezone.utc)
|
||||
match = re.search("^(?P<name>[a-z0-9-]+)-(?P<rev>\d\d-\d\d)\.txt$", fname)
|
||||
if match:
|
||||
name = match.group("name")
|
||||
rev = match.group("rev")
|
||||
else:
|
||||
match = re.search("^(?P<name>[a-z0-9-]+)-(?P<rev>\d\d)\.txt$", fname)
|
||||
if match:
|
||||
name = match.group("name")
|
||||
rev = match.group("rev")
|
||||
else:
|
||||
warn("Failed extracting revision from filename: '%s'" % fname)
|
||||
try:
|
||||
doc = Document.objects.get(type="charter", name=name)
|
||||
try:
|
||||
event = NewRevisionDocEvent.objects.get(doc=doc, type='new_revision', rev=rev)
|
||||
note(".")
|
||||
except NewRevisionDocEvent.MultipleObjectsReturned, e:
|
||||
warn("Multiple NewRevisionDocEvent exists for '%s'" % fname)
|
||||
except NewRevisionDocEvent.DoesNotExist:
|
||||
event = NewRevisionDocEvent(doc=doc, type='new_revision', rev=rev, by=system_entity, time=ftime, desc="")
|
||||
event.save()
|
||||
note("Created new NewRevisionDocEvent for %s-%s" % (name, rev))
|
||||
except Document.DoesNotExist:
|
||||
warn("Document not found: '%s'; no NewRevisionDocEvent created for '%s'" % (name, fname))
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
version = "0.10"
|
||||
program = os.path.basename(sys.argv[0])
|
||||
progdir = os.path.dirname(sys.argv[0])
|
||||
|
||||
# boilerplate
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from django.template import Template, Context
|
||||
|
||||
from ietf.doc.models import Document
|
||||
from ietf.person.models import Person
|
||||
|
||||
drafts = Document.objects.filter(type="draft")
|
||||
|
||||
ads = {}
|
||||
for p in Person.objects.filter(ad_document_set__type="draft").distinct():
|
||||
ads[p.id] = p.role_email("ad")
|
||||
|
||||
for d in drafts:
|
||||
d.ad_email = ads.get(d.ad_id)
|
||||
|
||||
templ_text = """{% for draft in drafts %}{% if draft.notify or draft.ad_email %}{{ draft.name }}{% if draft.notify %} docnotify='{{ draft.notify|cut:"<"|cut:">" }}'{% endif %}{% if draft.ad_email %} docsponsor='{{ draft.ad_email }}'{% endif %}
|
||||
{% endif %}{% endfor %}"""
|
||||
template = Template(templ_text)
|
||||
context = Context({ 'drafts':drafts })
|
||||
|
||||
print template.render(context).encode('utf-8')
|
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys, os, sys
|
||||
import syslog
|
||||
|
||||
# boilerplate
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-t", "--to", dest="to",
|
||||
help="Email address to send report to", metavar="EMAIL")
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_USER)
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from ietf.sync.mails import email_discrepancies
|
||||
|
||||
receivers = ["iesg-secretary@ietf.org"]
|
||||
|
||||
if options.to:
|
||||
receivers = [options.to]
|
||||
|
||||
email_discrepancies(receivers)
|
||||
|
||||
syslog.syslog("Emailed sync discrepancies to %s" % receivers)
|
|
@ -1,106 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
version = "0.10"
|
||||
program = os.path.basename(sys.argv[0])
|
||||
progdir = os.path.dirname(sys.argv[0])
|
||||
|
||||
# boilerplate
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def note(string):
|
||||
sys.stdout.write("%s\n" % (string))
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def warn(string):
|
||||
sys.stderr.write(" * %s\n" % (string))
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
import re
|
||||
from datetime import datetime as Datetime
|
||||
import time
|
||||
import warnings
|
||||
warnings.filterwarnings('ignore', message='the sets module is deprecated', append=True)
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from ietf.utils.path import path as Path
|
||||
|
||||
from ietf.submit.models import Submission
|
||||
from ietf.doc.models import Document
|
||||
|
||||
|
||||
|
||||
args = sys.argv[1:]
|
||||
if len(args) < 3:
|
||||
warn("Expected '$ %s DRAFTNAME USER.LOG POSTFIX.LOG', but found no arguments -- exiting" % program)
|
||||
sys.exit(1)
|
||||
|
||||
draft = args[0]
|
||||
if re.search("\.txt$", draft):
|
||||
draft = draft[:-4]
|
||||
if re.search("-\d\d$", draft):
|
||||
draft = draft[:-3]
|
||||
|
||||
if len(args) == 1:
|
||||
logfiles = [ arg[1] ]
|
||||
else:
|
||||
logfiles = args[1:]
|
||||
|
||||
from_email = settings.IDSUBMIT_FROM_EMAIL
|
||||
if "<" in from_email:
|
||||
from_email = from_email.split("<")[1].split(">")[0]
|
||||
|
||||
submission = Submission.objects.filter(name=draft).latest('submission_date')
|
||||
document = Document.objects.get(name=draft)
|
||||
emails = [ author.email.address for author in document.documentauthor_set.all() if author.email ]
|
||||
|
||||
timestrings = []
|
||||
for file in [ Path(settings.INTERNET_DRAFT_PATH) / ("%s-%s.txt"%(draft, submission.rev)),
|
||||
Path(settings.IDSUBMIT_STAGING_PATH) / ("%s-%s.txt"%(draft, submission.rev)) ]:
|
||||
if os.path.exists(file):
|
||||
upload_time = time.localtime(file.mtime)
|
||||
ts = time.strftime("%b %d %H:%M", upload_time)
|
||||
timestrings += [ ts ]
|
||||
timestrings += [ ts[:-1] + chr(((ord(ts[-1])-ord('0')+1)%10)+ord('0')) ]
|
||||
print "Looking for mail log lines timestamped %s, also checking %s ..." % (timestrings[0], timestrings[1])
|
||||
|
||||
for log in logfiles:
|
||||
print "\n Checking %s ...\n" % log
|
||||
if log.endswith('.gz'):
|
||||
import gzip
|
||||
logfile = gzip.open(log)
|
||||
else:
|
||||
logfile = io.open(log)
|
||||
queue_ids = []
|
||||
for line in logfile:
|
||||
if from_email in line and "Confirmation for Auto-Post of I-D "+draft in line:
|
||||
ts = line[:12]
|
||||
timestrings += [ ts ]
|
||||
print "Found a mention of %s, adding timestamp %s: \n %s" % (draft, ts, line)
|
||||
for ts in timestrings:
|
||||
if line.startswith(ts):
|
||||
if from_email in line:
|
||||
for to_email in emails:
|
||||
if to_email in line:
|
||||
sys.stdout.write(line)
|
||||
if "queued_as:" in line:
|
||||
queue_ids += [ line.split("queued_as:")[1].split(",")[0] ]
|
||||
elif queue_ids:
|
||||
for qi in queue_ids:
|
||||
if qi in line:
|
||||
sys.stdout.write(line)
|
|
@ -1,27 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- Python -*-
|
||||
#
|
||||
'''
|
||||
This script calls ietf.meeting.helpers.check_interim_minutes() which sends
|
||||
a reminder email for interim meetings that occurred 10 days ago but still
|
||||
don't have minutes.
|
||||
'''
|
||||
|
||||
# Set PYTHONPATH and load environment variables for standalone script -----------------
|
||||
import os, sys
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
from ietf.meeting.helpers import check_interim_minutes
|
||||
|
||||
check_interim_minutes()
|
|
@ -1,36 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
|
||||
import os, sys
|
||||
import syslog
|
||||
|
||||
# boilerplate
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_USER)
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from django.utils.encoding import force_str
|
||||
from ietf.group.models import Role
|
||||
|
||||
addresses = set()
|
||||
for role in Role.objects.filter(
|
||||
group__state__slug='active',
|
||||
group__type__in=['ag','area','dir','iab','ietf','irtf','nomcom','rg','team','wg','rag']):
|
||||
#sys.stderr.write(str(role)+'\n')
|
||||
for e in role.person.email_set.all():
|
||||
if e.active and not e.address.startswith('unknown-email-'):
|
||||
addresses.add(e.address)
|
||||
|
||||
addresses = list(addresses)
|
||||
addresses.sort()
|
||||
for a in addresses:
|
||||
print(force_str(a))
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
python manage.py dumpdata --format=xml "$@" | sed -e 's/<\/*object/\
|
||||
&/g' -e 's/<field/\
|
||||
&/g' -e 's/<\/django-objects/\
|
||||
&/g'
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright The IETF Trust 2007, All Rights Reserved
|
||||
#
|
||||
#python manage.py dumpdata --format=xml redirects | xmllint --format -
|
||||
python manage.py dumpdata --format=xml redirects | sed -e 's/<\/*object/\
|
||||
&/g' -e 's/<field/\
|
||||
&/g' -e 's/<\/django-objects/\
|
||||
&/g'
|
|
@ -1,38 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Run some non-modifying tests on top of the real database, to
|
||||
# exercise the code with real data.
|
||||
#
|
||||
|
||||
import os, subprocess, datetime
|
||||
|
||||
base_dir = os.path.relpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
|
||||
|
||||
path = os.path.abspath(os.path.join(base_dir, ".."))
|
||||
if os.environ.get("PYTHONPATH"):
|
||||
path += ":" + os.environ.get("PYTHONPATH")
|
||||
os.environ["PYTHONPATH"] = path
|
||||
|
||||
|
||||
|
||||
def run_script(script, *args):
|
||||
script_base = os.path.splitext(os.path.basename(script))[0]
|
||||
script_path = os.path.join(base_dir, script)
|
||||
output_path = os.path.join(base_dir, script_base)
|
||||
arg_str = " " + " ".join(args) if args else ""
|
||||
cmd_line = "%s%s > %s.output" % (script_path, arg_str, output_path)
|
||||
print "Running %s" % cmd_line
|
||||
before = datetime.datetime.now()
|
||||
returncode = subprocess.call(cmd_line, shell=True)
|
||||
print " (took %.3f seconds)" % (datetime.datetime.now() - before).total_seconds()
|
||||
return returncode
|
||||
|
||||
# idindex
|
||||
run_script("idindex/generate_id_abstracts_txt.py")
|
||||
run_script("idindex/generate_id_index_txt.py")
|
||||
run_script("idindex/generate_all_id_txt.py")
|
||||
run_script("idindex/generate_all_id2_txt.py")
|
||||
|
||||
# test crawler
|
||||
crawl_input = os.path.join(base_dir, "utils/crawlurls.txt")
|
||||
run_script("bin/test-crawl", "--urls %s" % crawl_input)
|
|
@ -1,87 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- Python -*-
|
||||
#
|
||||
'''
|
||||
This script configures Django Admin permissions
|
||||
'''
|
||||
|
||||
# Set PYTHONPATH and load environment variables for standalone script -----------------
|
||||
import os, sys
|
||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
from django.contrib.auth.models import Group as AuthGroup
|
||||
from django.contrib.auth.models import Permission
|
||||
from ietf.group.models import Group
|
||||
|
||||
|
||||
def permission_names_to_objects(names):
|
||||
"""
|
||||
Given an iterable of permission names (e.g. 'app_label.add_model'),
|
||||
return an iterable of Permission objects for them. The permission
|
||||
must already exist, because a permission name is not enough information
|
||||
to create a new permission.
|
||||
"""
|
||||
result = []
|
||||
for name in names:
|
||||
app_label, codename = name.split(".", 1)
|
||||
try:
|
||||
result.append(Permission.objects.get(content_type__app_label=app_label,
|
||||
codename=codename))
|
||||
except Permission.DoesNotExist:
|
||||
print ("NO SUCH PERMISSION: %s, %s" % (app_label, codename))
|
||||
raise
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def main():
|
||||
secretariat = Group.objects.get(acronym='secretariat')
|
||||
users = [ r.person.user for r in secretariat.role_set.filter(name='secr') ]
|
||||
|
||||
# Set Auth Group members
|
||||
auth_group, _ = AuthGroup.objects.get_or_create(name='secretariat')
|
||||
auth_group.user_set.set(users)
|
||||
|
||||
# Set Auth Group Admin Permissions
|
||||
names = ['auth.add_user','auth.change_user','auth.delete_user',
|
||||
'dbtemplate.change_dbtemplate',
|
||||
'group.add_group','group.change_group','group.delete_group',
|
||||
'group.add_role','group.change_role','group.delete_role',
|
||||
'group.add_groupevent','group.change_groupevent','group.delete_groupevent',
|
||||
'iesg.add_telechatagendaitem','iesg.change_telechatagendaitem','iesg.delete_telechatagendaitem',
|
||||
'iesg.add_telechatdate','iesg.change_telechatdate','iesg.delete_telechatdate',
|
||||
'liaisons.add_liaisonstatementgroupcontacts', 'liaisons.change_liaisonstatementgroupcontacts', 'liaisons.delete_liaisonstatementgroupcontacts',
|
||||
'mailinglists.add_list','mailinglists.change_list','mailinglists.delete_list',
|
||||
'mailtrigger.add_mailtrigger','mailtrigger.change_mailtrigger','mailtrigger.delete_mailtrigger',
|
||||
'mailtrigger.add_recipient','mailtrigger.change_recipient','mailtrigger.delete_recipient',
|
||||
'meeting.add_floorplan','meeting.change_floorplan','meeting.delete_floorplan',
|
||||
'meeting.add_importantdate','meeting.change_importantdate','meeting.delete_importantdate',
|
||||
'meeting.add_meeting','meeting.change_meeting','meeting.delete_meeting',
|
||||
'meeting.add_room','meeting.change_room','meeting.delete_room',
|
||||
'meeting.add_urlresource','meeting.change_urlresource','meeting.delete_urlresource',
|
||||
'message.add_announcementfrom','message.change_announcementfrom','message.delete_announcementfrom',
|
||||
'nomcom.add_nomcom','nomcom.change_nomcom','nomcom.delete_nomcom',
|
||||
'nomcom.add_volunteer','nomcom.change_volunteer','nomcom.delete_volunteer',
|
||||
'person.add_person','person.change_person','person.delete_person',
|
||||
'person.add_alias','person.change_alias','person.delete_alias',
|
||||
'person.add_email','person.change_email','person.delete_email',
|
||||
'submit.add_submission','submit.change_submission','submit.delete_submission',
|
||||
]
|
||||
|
||||
permissions = permission_names_to_objects(names)
|
||||
auth_group.permissions.set(permissions)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,18 +0,0 @@
|
|||
# List of starting points for the test crawler (see
|
||||
# bin/run-real-data-tests). Add URLs that have no link from inside the
|
||||
# project.
|
||||
|
||||
/
|
||||
/doc/all/
|
||||
/doc/iesg/last-call/
|
||||
/doc/in-last-call/
|
||||
/iesg/decisions/
|
||||
/iesg/agenda/documents.txt
|
||||
/iesg/agenda/agenda.json
|
||||
/wg/1wg-summary.txt
|
||||
/wg/1wg-summary-by-acronym.txt
|
||||
/wg/1wg-charters.txt
|
||||
/wg/1wg-charters-by-acronym.txt
|
||||
/sitemap.xml
|
||||
/sitemap-ipr.xml
|
||||
/sitemap-liaison.xml
|
Loading…
Reference in a new issue