Beispiel #1
0
def sync(frompath,topath,installpathlog):
    # get the log file
    logpath = path(installpathlog)
    logtext = logpath.lines()
    oldlog = parse(logtext)
    
    #move old log out of way
    logpath.move('installwatch-old.log')

    try:
        cmd('LANG=C cp -v -r %s/* %s/. >%s' % (frompath,topath,logpath))
    except:
        log('installing failed')
        oldlogpath = path('installwatch-old.log')
        oldlogpath.move(logpath)
        raise
    
    #parse new log
    newlogtext = logpath.lines()
    newlog = parse(newlogtext)
    
    #get log differences (for deletes)
    deletedpaths = oldlog - newlog
    
    #walk and delete the files that don't exist anymore
    for file in deletedpaths:
        if file.isfile() and not file.isdir():
            log('removing %s' % file)
            file.remove()
Beispiel #2
0
def parse(log):
    result = set()
    failures = False
    for line in log:
        line = line.rstrip()
        from_,to = line.split(' -> ')
        assert to[0] == "`" and to[-1]=="'"
        to = path(to[1:-1]).abspath()
        result.add(to)
    return result
#!/usr/bin/python2.4
import os
from pyramid.path import path
os.umask(002)


BETABUILD_CHECKOUT_DIR=path('/data/website-build/build')
WWW_DIR = path('/data/ftp.python.org/pub/www.python.org')

VERBOSE = True

def log(message):
    if VERBOSE:
        print message

def cmd(command):
    log(command)
    child = os.popen(command)
    data = child.read()
    err = child.close()
    if err:
        raise RuntimeError, '%s failed w/ exit code %d' % (command, err)
    return data

os.chdir(BETABUILD_CHECKOUT_DIR)

# Rebuild 
##cmd('pyramid -k -v -d data -o out -r images,styles,files,js --relativeurls')
cmd('new-build/build.py --cache=/data/tmp/pydotorg.cache -v '
    '-d data -o out -r images,styles,files,js')
#!/usr/bin/python2.4

import os
import sys
import pyramid
from pyramid.path import path
from datetime import datetime


os.umask(002)

VERBOSE=True

BETABUILD_CHECKOUT_DIR=path('/data/website-build/build')
WWW_DIR = '/data/ftp.python.org/pub/www.python.org'
UPDATEBETADIRS = ['data','styles','js','files','images']

BUILDINPROCESS = BETABUILD_CHECKOUT_DIR / 'status/buildinprocess'
BUILDQUEUED = BETABUILD_CHECKOUT_DIR / 'status/buildqueued'
PEPQUEUED = BETABUILD_CHECKOUT_DIR / 'status/pepqueued'
PEPDIR = BETABUILD_CHECKOUT_DIR / 'data/dev/peps'
JOBSDIR = BETABUILD_CHECKOUT_DIR / 'data/community/jobs'


def log(message):
    if VERBOSE:
        print message

def cmd(command):
    log(command)
    child = os.popen(command)