build.py'ye try/except bloğu eklendi ( 4 action betiği ), geri kalan coding standarta uymak adına...
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
import os
|
||||
|
||||
def configure( parameters = None):
|
||||
def configure(parameters = None):
|
||||
''' FIXME: Düzgün hale getirilecek '''
|
||||
''' {EXTRA} = '--with-nls --with-libusb --with-something-usefull '''
|
||||
|
||||
@@ -15,11 +15,11 @@ def configure( parameters = None):
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var/lib {EXTRA}'
|
||||
|
||||
os.system( configure_string.replace( '{EXTRA}', parameters ))
|
||||
os.system(configure_string.replace('{EXTRA}', parameters))
|
||||
|
||||
def make():
|
||||
''' FIXME: Düzgün hale getirilecek '''
|
||||
os.system( 'make' )
|
||||
os.system('make')
|
||||
|
||||
def install():
|
||||
''' FIXME: Düzgün hale getirilecek '''
|
||||
@@ -34,4 +34,4 @@ def install():
|
||||
install'
|
||||
|
||||
# FIXME: need to get install directory from pisi.config...
|
||||
os.system( install_string.replace( '{D}', os.path.dirname( os.path.dirname( os.getcwd())) + '/install' ))
|
||||
os.system(install_string.replace('{D}',os.path.dirname(os.path.dirname(os.getcwd())) + '/install'))
|
||||
|
||||
@@ -7,18 +7,18 @@ from shell import *
|
||||
def gnuconfig_findnewest():
|
||||
''' find the newest config.* file according to timestamp and return it '''
|
||||
|
||||
locations = [ '/usr/share/gnuconfig/config.sub', '/usr/share/automake-1.8/config.sub', '/usr/share/automake-1.7/config.sub', '/usr/share/automake-1.6/config.sub', '/usr/share/automake-1.5/config.sub', '/usr/share/automake-1.4/config.sub' ]
|
||||
locations = ['/usr/share/gnuconfig/config.sub', '/usr/share/automake-1.8/config.sub', '/usr/share/automake-1.7/config.sub', '/usr/share/automake-1.6/config.sub', '/usr/share/automake-1.5/config.sub', '/usr/share/automake-1.4/config.sub']
|
||||
|
||||
newer_location = {}
|
||||
|
||||
for i in locations:
|
||||
newer_location[i] = re.sub( '\'', '', string.split( ( cat( i ) | tr( str.rstrip ) | grep ( '^timestamp' ) | join ), '=')[1] )
|
||||
newer_location[i] = re.sub( '\'', '', string.split((cat( i ) | tr(str.rstrip) | grep ('^timestamp') | join), '=')[1])
|
||||
|
||||
keys = newer_location.keys()
|
||||
keys.sort()
|
||||
map(newer_location.get, keys )
|
||||
map(newer_location.get, keys)
|
||||
|
||||
return os.path.dirname( newer_location.popitem()[0] )
|
||||
return os.path.dirname(newer_location.popitem()[0])
|
||||
|
||||
def gnuconfig_update():
|
||||
''' copy newest config.* onto source's '''
|
||||
@@ -26,8 +26,8 @@ def gnuconfig_update():
|
||||
newer_location = gnuconfig_findnewest()
|
||||
|
||||
try:
|
||||
shutil.copyfile( newer_location + '/config.sub', os.getcwd() + '/config.sub' )
|
||||
shutil.copyfile( newer_location + '/config.guess', os.getcwd() + '/config.guess' )
|
||||
shutil.copyfile(newer_location + '/config.sub', os.getcwd() + '/config.sub')
|
||||
shutil.copyfile(newer_location + '/config.guess', os.getcwd() + '/config.guess')
|
||||
except IOError:
|
||||
print 'Hata mata...'
|
||||
sys.exit()
|
||||
|
||||
@@ -12,5 +12,5 @@ def libtoolize():
|
||||
|
||||
# no need to create a context for calling static functions
|
||||
# currently staticmethods doesn't work in Contex but this function isn't used to ;)
|
||||
os.system( 'patch -sN < ' + Context.lib_dir() + '/portage-1.4.1.patch' )
|
||||
os.system( 'patch -sN < ' + Context.lib_dir() + '/sed-1.4.0.patch' )
|
||||
os.system('patch -sN < ' + Context.lib_dir() + '/portage-1.4.1.patch')
|
||||
os.system('patch -sN < ' + Context.lib_dir() + '/sed-1.4.0.patch')
|
||||
|
||||
@@ -5,53 +5,53 @@ import sys, re
|
||||
from itertools import izip, imap, count, ifilter, ifilterfalse
|
||||
|
||||
def cat( filename ):
|
||||
return file( filename ).xreadlines()
|
||||
return file(filename).xreadlines()
|
||||
|
||||
class grep:
|
||||
"""keep only lines that match the regexp"""
|
||||
def __init__( self,pat, flags = 0 ):
|
||||
self.fun = re.compile( pat, flags ).match
|
||||
def __ror__( self, input ):
|
||||
return ifilter( self.fun, input )
|
||||
def __init__(self,pat, flags = 0):
|
||||
self.fun = re.compile(pat, flags).match
|
||||
def __ror__(self, input):
|
||||
return ifilter(self.fun, input)
|
||||
|
||||
class tr:
|
||||
"""apply arbitrary transform to each sequence element"""
|
||||
def __init__( self, transform ):
|
||||
def __init__(self, transform):
|
||||
self.tr = transform
|
||||
def __ror__( self, input ):
|
||||
return imap( self.tr, input )
|
||||
def __ror__(self, input):
|
||||
return imap(self.tr, input)
|
||||
|
||||
class printto:
|
||||
"""print sequence elements one per line"""
|
||||
def __init__( self, out = sys.stdout ):
|
||||
def __init__(self, out = sys.stdout):
|
||||
self.out = out
|
||||
def __ror__( self,input ):
|
||||
def __ror__(self,input):
|
||||
for l in input:
|
||||
print >> self.out, l
|
||||
|
||||
printlines = printto( sys.stdout )
|
||||
printlines = printto(sys.stdout)
|
||||
|
||||
class terminator:
|
||||
def __init__( self,method ):
|
||||
def __init__(self,method):
|
||||
self.process = method
|
||||
def __ror__( self,input ):
|
||||
return self.process( input )
|
||||
def __ror__(self,input):
|
||||
return self.process(input)
|
||||
|
||||
aslist = terminator( list )
|
||||
asdict = terminator( dict )
|
||||
astuple = terminator( tuple )
|
||||
join = terminator( "".join )
|
||||
enum = terminator( enumerate )
|
||||
aslist = terminator(list)
|
||||
asdict = terminator(dict)
|
||||
astuple = terminator(tuple)
|
||||
join = terminator("".join)
|
||||
enum = terminator(enumerate)
|
||||
|
||||
class sort:
|
||||
def __ror__( self,input ):
|
||||
ll = list( input )
|
||||
def __ror__(self,input):
|
||||
ll = list(input)
|
||||
ll.sort()
|
||||
return ll
|
||||
sort = sort()
|
||||
|
||||
class uniq:
|
||||
def __ror__( self,input ):
|
||||
def __ror__(self,input):
|
||||
for i in input:
|
||||
try:
|
||||
if i == prev:
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import time
|
||||
from tempfile import mkstemp, mkdtemp
|
||||
|
||||
def sleep( sleep_time = 5 ):
|
||||
time.sleep( sleep_time )
|
||||
def sleep(sleep_time = 5):
|
||||
time.sleep(sleep_time)
|
||||
|
||||
def createTmpFile():
|
||||
handle, path = mkstemp()
|
||||
|
||||
+11
-7
@@ -48,24 +48,28 @@ class PisiBuild:
|
||||
|
||||
# applyPatches()
|
||||
|
||||
self.actionScript = open( os.path.dirname( self.ctx.pspecfile ) + '/' + 'actions' ).read()
|
||||
|
||||
try:
|
||||
self.actionScript = open(os.path.dirname(self.ctx.pspecfile ) + '/' + 'actions').read()
|
||||
except IOError, e:
|
||||
print "Action Script: %s" % e
|
||||
return
|
||||
|
||||
# FIXME: It's wrong to assume that unpacked archive
|
||||
# will create a name-version top-level directory.
|
||||
# Archive module should give the exact location.
|
||||
# (from the assumption is evil dept.)
|
||||
os.chdir( self.ctx.build_work_dir() + "/" + self.spec.source.name + "-" + self.spec.source.version)
|
||||
os.chdir(self.ctx.build_work_dir() + "/" + self.spec.source.name + "-" + self.spec.source.version)
|
||||
locals = globals = {}
|
||||
|
||||
try:
|
||||
exec compile( self.actionScript , "error", "exec" ) in locals,globals
|
||||
exec compile(self.actionScript , "error", "exec") in locals,globals
|
||||
except SyntaxError, e:
|
||||
print "Error : %s" % e
|
||||
return
|
||||
|
||||
self.configureSource( locals )
|
||||
self.buildSource( locals )
|
||||
self.installSource( locals )
|
||||
self.configureSource(locals)
|
||||
self.buildSource(locals)
|
||||
self.installSource(locals)
|
||||
|
||||
def fetchArchive(self, percentHook=None):
|
||||
"""fetch an archive and store to ctx.archives_dir()
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
# installation database
|
||||
# maintainer: eray and caglar
|
||||
|
||||
import config
|
||||
from context import Context
|
||||
import util
|
||||
import bsddb.dbshelve as shelve
|
||||
|
||||
util.check_dir( config.db_dir() )
|
||||
d = shelve.open( config.db_dir() + '/install.bdb')
|
||||
files_dir = config.archives_dir() + "/files"
|
||||
util.check_dir(Context.db_dir())
|
||||
d = shelve.open(Context.db_dir() + '/install.bdb')
|
||||
files_dir = Context.archives_dir() + "/files"
|
||||
|
||||
class InstallDBError(Exception):
|
||||
pass
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ def info(msg):
|
||||
# default UI implementation
|
||||
class CLI:
|
||||
def info(self, msg):
|
||||
sys.stdout.write( bold( red (msg)))
|
||||
sys.stdout.write(bold(red(msg)))
|
||||
sys.stdout.flush()
|
||||
|
||||
# default UI is CLI
|
||||
|
||||
Reference in New Issue
Block a user