re-factor continues and some cosmetic changes for our coding standarts
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
ReFactor ActionsAPI:
|
ReFactor ActionsAPI:
|
||||||
|
|
||||||
pisitools.py - %80
|
pisitools.py - %80
|
||||||
autotools.py - %0
|
autotools.py - %50
|
||||||
get.py - %50
|
get.py - %75
|
||||||
kde.py - %0
|
kde.py - %0
|
||||||
libtools.py - %25
|
libtools.py - %25
|
||||||
pisitools_functions.py - %50
|
pisitools_functions.py - %50
|
||||||
shelltools.py - %50
|
shelltools.py - %50
|
||||||
variables.py - %100
|
variables.py - %100
|
||||||
|
coreutils.py - %100
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# pisi.actionsapi version
|
# pisi.actionsapi version
|
||||||
__version__ = "0.1"
|
__version__ = '0.1'
|
||||||
|
|||||||
@@ -11,59 +11,41 @@
|
|||||||
# Please read the COPYING file.
|
# Please read the COPYING file.
|
||||||
#
|
#
|
||||||
|
|
||||||
# standard python modules
|
# Standard Python Modules
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# actions api modules
|
# ActionsAPI Modules
|
||||||
from variables import glb
|
import get
|
||||||
|
from shelltools import system
|
||||||
|
|
||||||
def configure(parameters = ''):
|
def configure(parameters = ''):
|
||||||
''' FIXME: Düzgün hale getirilecek '''
|
''' configure source with given parameters = "--with-nls --with-libusb --with-something-usefull"'''
|
||||||
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
|
|
||||||
dirs = glb.dirs
|
|
||||||
env = glb.env
|
|
||||||
|
|
||||||
configure_string = './configure --prefix=/%s \
|
configure_string = './configure --prefix=/%s --host=%s --mandir=/%s \
|
||||||
--host=%s \
|
--infodir=/%s --datadir=/%s --sysconfdir=/%s \
|
||||||
--mandir=/%s \
|
--localstatedir=/%s %s' \
|
||||||
--infodir=/%s \
|
% (get.defaultprefixDIR(), get.HOST(), get.manDIR(),
|
||||||
--datadir=/%s \
|
get.infoDIR(), get.dataDIR(), get.confDIR(),
|
||||||
--sysconfdir=/%s \
|
get.localstateDIR(), parameters)
|
||||||
--localstatedir=/%s \
|
|
||||||
%s' % (dirs.defaultprefix,
|
|
||||||
env.host,
|
|
||||||
dirs.man,
|
|
||||||
dirs.info,
|
|
||||||
dirs.data,
|
|
||||||
dirs.conf,
|
|
||||||
dirs.localstate,
|
|
||||||
parameters)
|
|
||||||
|
|
||||||
os.system(configure_string)
|
system(configure_string)
|
||||||
|
|
||||||
def rawConfigure(parameters = ''):
|
def rawConfigure(parameters = ''):
|
||||||
os.system('./configure ' + parameters)
|
''' configure source with given parameters = " --prefix=/usr --libdir=/usr/lib --with-nls"'''
|
||||||
|
system('./configure %s' % parameters)
|
||||||
|
|
||||||
|
#FIXME: Find another way!
|
||||||
def rawConfigureWithPrefix(prefix='', parameters = ''):
|
def rawConfigureWithPrefix(prefix='', parameters = ''):
|
||||||
os.system(prefix + ' ./configure ' + parameters)
|
system('%s ./configure %s' % ( prefix, parameters))
|
||||||
|
|
||||||
def compile(parameters = ''):
|
def compile(parameters = ''):
|
||||||
compile_string = 'gcc ${CFLAGS} %s' % parameters
|
system('%s %s %s' % (get.GCC(), get.CFLAGS(), parameters))
|
||||||
os.system(compile_string)
|
|
||||||
|
|
||||||
def make(parameters = ''):
|
def make(parameters = ''):
|
||||||
''' FIXME: Düzgün hale getirilecek '''
|
make_string = ('make %s' % parameters)
|
||||||
make_string = 'make %s' % parameters
|
system(make_string)
|
||||||
os.system(make_string)
|
|
||||||
|
|
||||||
def install(parameters = ''):
|
def install(parameters = ''):
|
||||||
''' FIXME: Düzgün hale getirilecek '''
|
|
||||||
''' dir_suffix = /var/tmp/pisi/ _paket_adı_ /image/ '''
|
|
||||||
dirs = glb.dirs
|
|
||||||
|
|
||||||
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
|
||||||
glb.const.install_dir_suffix
|
|
||||||
|
|
||||||
install_string = 'make prefix=%(prefix)s/%(defaultprefix)s \
|
install_string = 'make prefix=%(prefix)s/%(defaultprefix)s \
|
||||||
datadir=%(prefix)s/%(data)s \
|
datadir=%(prefix)s/%(data)s \
|
||||||
infodir=%(prefix)s/%(info)s \
|
infodir=%(prefix)s/%(info)s \
|
||||||
@@ -71,65 +53,25 @@ def install(parameters = ''):
|
|||||||
mandir=%(prefix)s/%(man)s \
|
mandir=%(prefix)s/%(man)s \
|
||||||
sysconfdir=%(prefix)s/%(conf)s \
|
sysconfdir=%(prefix)s/%(conf)s \
|
||||||
%(parameters)s \
|
%(parameters)s \
|
||||||
install' % {'prefix': dir_suffix,
|
install' % {'prefix': get.installDIR(),
|
||||||
'defaultprefix': dirs.defaultprefix,
|
'defaultprefix': get.defaultprefixDIR(),
|
||||||
'man': dirs.man,
|
'man': get.manDIR(),
|
||||||
'info': dirs.info,
|
'info': get.infoDIR(),
|
||||||
'localstate': dirs.localstate,
|
'localstate': get.localstateDIR(),
|
||||||
'conf': dirs.conf,
|
'conf': get.confDIR(),
|
||||||
'data': dirs.data,
|
'data': get.dataDIR(),
|
||||||
'parameters': parameters}
|
'parameters': parameters}
|
||||||
|
|
||||||
os.system(install_string)
|
system(install_string)
|
||||||
|
|
||||||
def installWithPrefix(parameters = ''):
|
|
||||||
dirs = glb.dirs
|
|
||||||
|
|
||||||
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
|
||||||
glb.const.install_dir_suffix
|
|
||||||
|
|
||||||
install_string = 'make PREFIX=%s%s install' % (dir_suffix, parameters)
|
|
||||||
|
|
||||||
os.system(install_string)
|
|
||||||
|
|
||||||
def installWithDestdir(parameters = ''):
|
|
||||||
dirs = glb.dirs
|
|
||||||
|
|
||||||
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
|
||||||
glb.const.install_dir_suffix
|
|
||||||
|
|
||||||
install_string = 'make install DESTDIR=%s %s' % (dir_suffix, parameters)
|
|
||||||
|
|
||||||
os.system(install_string)
|
|
||||||
|
|
||||||
def installWithBasedir():
|
|
||||||
dirs = glb.dirs
|
|
||||||
|
|
||||||
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
|
||||||
glb.const.install_dir_suffix
|
|
||||||
|
|
||||||
install_string = 'make BASEDIR=%s install' % dir_suffix
|
|
||||||
|
|
||||||
os.system(install_string)
|
|
||||||
|
|
||||||
def installWithInstallRootdir():
|
|
||||||
dirs = glb.dirs
|
|
||||||
|
|
||||||
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
|
||||||
glb.const.install_dir_suffix
|
|
||||||
|
|
||||||
install_string = 'make INSTALL_ROOT=%s install' % dir_suffix
|
|
||||||
|
|
||||||
os.system(install_string)
|
|
||||||
|
|
||||||
def rawInstall(parameters = ''):
|
def rawInstall(parameters = ''):
|
||||||
os.system("make %s install" % parameters)
|
system('make %s install' % parameters)
|
||||||
|
|
||||||
def aclocal(parameters = ''):
|
def aclocal(parameters = ''):
|
||||||
os.system("aclocal %s" % parameters)
|
system('aclocal %s' % parameters)
|
||||||
|
|
||||||
def autoconf(parameters = ''):
|
def autoconf(parameters = ''):
|
||||||
os.system("autoconf %s" % parameters)
|
system('autoconf %s' % parameters)
|
||||||
|
|
||||||
def automake(parameters = ''):
|
def automake(parameters = ''):
|
||||||
os.system("automake %s" % parameters)
|
system('automake %s' % parameters)
|
||||||
|
|||||||
@@ -20,21 +20,21 @@ def cat(filename):
|
|||||||
return file(filename).xreadlines()
|
return file(filename).xreadlines()
|
||||||
|
|
||||||
class grep:
|
class grep:
|
||||||
"""keep only lines that match the regexp"""
|
'''keep only lines that match the regexp'''
|
||||||
def __init__(self, pat, flags = 0):
|
def __init__(self, pat, flags = 0):
|
||||||
self.fun = re.compile(pat, flags).match
|
self.fun = re.compile(pat, flags).match
|
||||||
def __ror__(self, input):
|
def __ror__(self, input):
|
||||||
return ifilter(self.fun, input)
|
return ifilter(self.fun, input)
|
||||||
|
|
||||||
class tr:
|
class tr:
|
||||||
"""apply arbitrary transform to each sequence element"""
|
'''apply arbitrary transform to each sequence element'''
|
||||||
def __init__(self, transform):
|
def __init__(self, transform):
|
||||||
self.tr = transform
|
self.tr = transform
|
||||||
def __ror__(self, input):
|
def __ror__(self, input):
|
||||||
return imap(self.tr, input)
|
return imap(self.tr, input)
|
||||||
|
|
||||||
class printto:
|
class printto:
|
||||||
"""print sequence elements one per line"""
|
'''print sequence elements one per line'''
|
||||||
def __init__(self, out = sys.stdout):
|
def __init__(self, out = sys.stdout):
|
||||||
self.out = out
|
self.out = out
|
||||||
def __ror__(self,input):
|
def __ror__(self,input):
|
||||||
@@ -52,7 +52,7 @@ class terminator:
|
|||||||
aslist = terminator(list)
|
aslist = terminator(list)
|
||||||
asdict = terminator(dict)
|
asdict = terminator(dict)
|
||||||
astuple = terminator(tuple)
|
astuple = terminator(tuple)
|
||||||
join = terminator("".join)
|
join = terminator(''.join)
|
||||||
enum = terminator(enumerate)
|
enum = terminator(enumerate)
|
||||||
|
|
||||||
class sort:
|
class sort:
|
||||||
|
|||||||
+40
-17
@@ -20,6 +20,8 @@ from variables import glb
|
|||||||
env = glb.env
|
env = glb.env
|
||||||
dirs = glb.dirs
|
dirs = glb.dirs
|
||||||
|
|
||||||
|
# variables.Env
|
||||||
|
|
||||||
def pkgDIR():
|
def pkgDIR():
|
||||||
return env.pkg_dir
|
return env.pkg_dir
|
||||||
|
|
||||||
@@ -29,12 +31,6 @@ def workDIR():
|
|||||||
def installDIR():
|
def installDIR():
|
||||||
return env.install_dir
|
return env.install_dir
|
||||||
|
|
||||||
def infoDIR():
|
|
||||||
return os.path.join(installDIR(), dirs.info)
|
|
||||||
|
|
||||||
def manDIR():
|
|
||||||
return os.path.join(installDIR(), dirs.man)
|
|
||||||
|
|
||||||
def srcNAME():
|
def srcNAME():
|
||||||
return env.src_name
|
return env.src_name
|
||||||
|
|
||||||
@@ -62,33 +58,60 @@ def CXXFLAGS():
|
|||||||
def LDFLAGS():
|
def LDFLAGS():
|
||||||
return env.ldflags
|
return env.ldflags
|
||||||
|
|
||||||
|
# variables.Dirs
|
||||||
|
|
||||||
|
def docDIR():
|
||||||
|
return dirs.doc
|
||||||
|
|
||||||
|
def sbinDIR():
|
||||||
|
return dirs.sbin
|
||||||
|
|
||||||
|
def infoDIR():
|
||||||
|
return dirs.info
|
||||||
|
|
||||||
|
def manDIR():
|
||||||
|
return dirs.man
|
||||||
|
|
||||||
|
def dataDIR():
|
||||||
|
return dirs.data
|
||||||
|
|
||||||
|
def confDIR():
|
||||||
|
return dirs.conf
|
||||||
|
|
||||||
|
def localstateDIR():
|
||||||
|
return dirs.localstate
|
||||||
|
|
||||||
|
def defaultprefixDIR():
|
||||||
|
return dirs.defaultprefix
|
||||||
|
|
||||||
|
# Binutils Variables
|
||||||
|
|
||||||
def getBinutilsInfo(needed):
|
def getBinutilsInfo(needed):
|
||||||
return "%s-%s" % (HOST(), needed)
|
return '%s-%s' % (HOST(), needed)
|
||||||
|
|
||||||
def AR():
|
def AR():
|
||||||
return getBinutilsInfo("ar")
|
return getBinutilsInfo('ar')
|
||||||
|
|
||||||
def AS():
|
def AS():
|
||||||
return getBinutilsInfo("as")
|
return getBinutilsInfo('as')
|
||||||
|
|
||||||
def CC():
|
def CC():
|
||||||
return getBinutilsInfo("gcc")
|
return getBinutilsInfo('gcc')
|
||||||
|
|
||||||
def CXX():
|
def CXX():
|
||||||
return getBinutilsInfo("g++")
|
return getBinutilsInfo('g++')
|
||||||
|
|
||||||
def LD():
|
def LD():
|
||||||
return getBinutilsInfo("ld")
|
return getBinutilsInfo('ld')
|
||||||
|
|
||||||
def NM():
|
def NM():
|
||||||
return getBinutilsInfo("nm")
|
return getBinutilsInfo('nm')
|
||||||
|
|
||||||
def RANLIB():
|
def RANLIB():
|
||||||
return getBinutilsInfo("ranlib")
|
return getBinutilsInfo('ranlib')
|
||||||
|
|
||||||
def F77():
|
def F77():
|
||||||
return getBinutilsInfo("f77")
|
return getBinutilsInfo('f77')
|
||||||
|
|
||||||
def GCJ():
|
def GCJ():
|
||||||
return getBinutilsInfo("gcj")
|
return getBinutilsInfo('gcj')
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def dodir(destinationDirectory):
|
|||||||
|
|
||||||
def dodoc(*sourceFiles):
|
def dodoc(*sourceFiles):
|
||||||
'''inserts the files in the list of files into /usr/share/doc/PACKAGE'''
|
'''inserts the files in the list of files into /usr/share/doc/PACKAGE'''
|
||||||
readable_insinto(get.installDIR() + "/usr/share/doc/" + get.srcTAG(), *sourceFiles)
|
readable_insinto(get.installDIR() + os.path.join('/usr/share/doc', get.srcTAG()), *sourceFiles)
|
||||||
|
|
||||||
def doenvd():
|
def doenvd():
|
||||||
#FIXME: AdditionalFiles
|
#FIXME: AdditionalFiles
|
||||||
@@ -61,7 +61,7 @@ def dohtml(*sourceFiles):
|
|||||||
'''inserts the files in the list of files into /usr/share/doc/PACKAGE/html'''
|
'''inserts the files in the list of files into /usr/share/doc/PACKAGE/html'''
|
||||||
|
|
||||||
''' example call: pisitools.dohtml("doc/doxygen/html/*")'''
|
''' example call: pisitools.dohtml("doc/doxygen/html/*")'''
|
||||||
destionationDirectory = os.path.join(get.installDIR(), "usr/share/doc" ,get.srcTAG(), "html")
|
destionationDirectory = os.path.join(get.installDIR(), 'usr/share/doc' ,get.srcTAG(), 'html')
|
||||||
|
|
||||||
if not can_access_directory(destionationDirectory):
|
if not can_access_directory(destionationDirectory):
|
||||||
makedirs(os.getcwd() + destionationDirectory)
|
makedirs(os.getcwd() + destionationDirectory)
|
||||||
@@ -72,17 +72,17 @@ def dohtml(*sourceFiles):
|
|||||||
for sourceFile in sourceFiles:
|
for sourceFile in sourceFiles:
|
||||||
for source in glob.glob(sourceFile):
|
for source in glob.glob(sourceFile):
|
||||||
if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions:
|
if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions:
|
||||||
os.system("install -m0644 %s %s" % (source, destionationDirectory))
|
os.system('install -m0644 %s %s' % (source, destionationDirectory))
|
||||||
if os.path.isdir(source) and os.path.basename(source) not in disallowed_directories:
|
if os.path.isdir(source) and os.path.basename(source) not in disallowed_directories:
|
||||||
for root, dirs, files in os.walk(source):
|
for root, dirs, files in os.walk(source):
|
||||||
for source in files:
|
for source in files:
|
||||||
if os.path.splitext(source)[1] in allowed_extensions:
|
if os.path.splitext(source)[1] in allowed_extensions:
|
||||||
makedirs(destionationDirectory)
|
makedirs(destionationDirectory)
|
||||||
os.system("install -m0644 %s %s" % (os.path.join(root, source), destionationDirectory))
|
os.system('install -m0644 %s %s' % (os.path.join(root, source), destionationDirectory))
|
||||||
|
|
||||||
def doinfo(*sourceFiles):
|
def doinfo(*sourceFiles):
|
||||||
'''inserts the into files in the list of files into /usr/share/info'''
|
'''inserts the into files in the list of files into /usr/share/info'''
|
||||||
readable_insinto(get.infoDIR(), *sourceFiles)
|
readable_insinto(os.path.join(get.installDIR(), get.infoDIR()), *sourceFiles)
|
||||||
|
|
||||||
def doinitd():
|
def doinitd():
|
||||||
#FIXME: AdditionalFiles
|
#FIXME: AdditionalFiles
|
||||||
@@ -127,8 +127,9 @@ def doman(*sourceFiles):
|
|||||||
'''inserts the man pages in the list of files into /usr/share/man/'''
|
'''inserts the man pages in the list of files into /usr/share/man/'''
|
||||||
|
|
||||||
'''example call: pisitools.doman("man.1", "pardus.*")'''
|
'''example call: pisitools.doman("man.1", "pardus.*")'''
|
||||||
if not can_access_directory(get.manDIR()):
|
manDIR = os.path.join(get.installDIR(), get.manDIR())
|
||||||
makedirs(get.manDIR())
|
if not can_access_directory(manDIR):
|
||||||
|
makedirs(manDIR)
|
||||||
|
|
||||||
for sourceFile in sourceFiles:
|
for sourceFile in sourceFiles:
|
||||||
for source in glob.glob(sourceFile):
|
for source in glob.glob(sourceFile):
|
||||||
@@ -136,11 +137,11 @@ def doman(*sourceFiles):
|
|||||||
#FIXME: splitext
|
#FIXME: splitext
|
||||||
pageName, pageDirectory = source.split('.')
|
pageName, pageDirectory = source.split('.')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print "doman: Wrong man page file"
|
print 'doman: Wrong man page file'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
makedirs(get.manDIR() + '/man%s' % pageDirectory)
|
makedirs(manDIR + '/man%s' % pageDirectory)
|
||||||
os.system("install -m0644 %s %s" % (source, get.manDIR() + '/man%s' % pageDirectory))
|
os.system('install -m0644 %s %s' % (source, manDIR + '/man%s' % pageDirectory))
|
||||||
|
|
||||||
def domo_(*sourceFiles):
|
def domo_(*sourceFiles):
|
||||||
'''inserts the mo files in the list of files into /usr/share/locale/LOCALE/LC_MESSAGES'''
|
'''inserts the mo files in the list of files into /usr/share/locale/LOCALE/LC_MESSAGES'''
|
||||||
@@ -175,7 +176,7 @@ def dosed(sourceFile, findPattern, replacePattern = ''):
|
|||||||
line = re.sub(findPattern, replacePattern, line)
|
line = re.sub(findPattern, replacePattern, line)
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
else:
|
else:
|
||||||
raise FileError("File doesn't exists or permission denied...")
|
raise FileError('File doesn\'t exists or permission denied...')
|
||||||
|
|
||||||
def dosbin(sourceFile, destinationDirectory = '/usr/sbin'):
|
def dosbin(sourceFile, destinationDirectory = '/usr/sbin'):
|
||||||
'''insert a executable file into /sbin or /usr/sbin'''
|
'''insert a executable file into /sbin or /usr/sbin'''
|
||||||
@@ -192,7 +193,7 @@ def dosym(sourceFile, destinationFile):
|
|||||||
try:
|
try:
|
||||||
os.symlink(sourceFile, get.installDIR() + destinationFile)
|
os.symlink(sourceFile, get.installDIR() + destinationFile)
|
||||||
except OSError:
|
except OSError:
|
||||||
print "dosym: File exists..."
|
print 'dosym: File exists...'
|
||||||
|
|
||||||
''' ************************************************************************** '''
|
''' ************************************************************************** '''
|
||||||
|
|
||||||
@@ -209,7 +210,7 @@ def insinto(destinationDirectory, sourceFile, destinationFile = ''):
|
|||||||
def newdoc(sourceFile, destinationFile):
|
def newdoc(sourceFile, destinationFile):
|
||||||
'''inserts a sourceFile into /usr/share/doc/PACKAGE/ directory as a destinationFile'''
|
'''inserts a sourceFile into /usr/share/doc/PACKAGE/ directory as a destinationFile'''
|
||||||
shutil.move(sourceFile, destinationFile)
|
shutil.move(sourceFile, destinationFile)
|
||||||
readable_insinto(get.installDIR() + "/usr/share/doc/" + get.srcTAG(), destinationFile)
|
readable_insinto(os.path.join(get.installDIR(), 'usr/share/doc', get.srcTAG()), destinationFile)
|
||||||
|
|
||||||
def newman(sourceFile, destinationFile):
|
def newman(sourceFile, destinationFile):
|
||||||
'''inserts a sourceFile into /usr/share/man/manPREFIX/ directory as a destinationFile'''
|
'''inserts a sourceFile into /usr/share/man/manPREFIX/ directory as a destinationFile'''
|
||||||
|
|||||||
@@ -30,35 +30,35 @@ def executable_insinto(sourceFile, destinationDirectory):
|
|||||||
'''insert a executable file into destinationDirectory'''
|
'''insert a executable file into destinationDirectory'''
|
||||||
|
|
||||||
if not sourceFile or not destinationDirectory:
|
if not sourceFile or not destinationDirectory:
|
||||||
raise ArgumentError("Insufficient arguments...")
|
raise ArgumentError('Insufficient arguments...')
|
||||||
|
|
||||||
if not can_access_file(sourceFile):
|
if not can_access_file(sourceFile):
|
||||||
raise FileError("File doesn't exists or permission denied...")
|
raise FileError('File doesn\'t exists or permission denied...')
|
||||||
|
|
||||||
if can_access_directory(destinationDirectory) and os.path.isdir(destinationDirectory):
|
if can_access_directory(destinationDirectory) and os.path.isdir(destinationDirectory):
|
||||||
os.system("install -m0755 -o root -g root %s %s" % (sourceFile, destinationDirectory))
|
os.system('install -m0755 -o root -g root %s %s' % (sourceFile, destinationDirectory))
|
||||||
else:
|
else:
|
||||||
makedirs(destinationDirectory)
|
makedirs(destinationDirectory)
|
||||||
os.system("install -m0755 -o root -g root %s %s" % (sourceFile, destinationDirectory))
|
os.system('install -m0755 -o root -g root %s %s' % (sourceFile, destinationDirectory))
|
||||||
|
|
||||||
def readable_insinto(destinationDirectory, *sourceFiles):
|
def readable_insinto(destinationDirectory, *sourceFiles):
|
||||||
'''inserts file list into destinationDirectory'''
|
'''inserts file list into destinationDirectory'''
|
||||||
|
|
||||||
if not sourceFiles or not destinationDirectory:
|
if not sourceFiles or not destinationDirectory:
|
||||||
raise ArgumentError("Insufficient arguments...")
|
raise ArgumentError('Insufficient arguments...')
|
||||||
|
|
||||||
if not can_access_directory(destinationDirectory):
|
if not can_access_directory(destinationDirectory):
|
||||||
makedirs(destinationDirectory)
|
makedirs(destinationDirectory)
|
||||||
|
|
||||||
for sourceFile in sourceFiles:
|
for sourceFile in sourceFiles:
|
||||||
for source in glob.glob(sourceFile):
|
for source in glob.glob(sourceFile):
|
||||||
os.system("install -m0644 %s %s" % (source, destinationDirectory))
|
os.system('install -m0644 %s %s' % (source, destinationDirectory))
|
||||||
|
|
||||||
def lib_insinto(sourceFile, destinationDirectory, permission = 0644):
|
def lib_insinto(sourceFile, destinationDirectory, permission = 0644):
|
||||||
'''inserts a library fileinto destinationDirectory with given permission'''
|
'''inserts a library fileinto destinationDirectory with given permission'''
|
||||||
|
|
||||||
if not sourceFiles or not destinationDirectory:
|
if not sourceFile or not destinationDirectory:
|
||||||
raise ArgumentError("Insufficient arguments...")
|
raise ArgumentError('Insufficient arguments...')
|
||||||
|
|
||||||
if not can_access_directory(destinationDirectory):
|
if not can_access_directory(destinationDirectory):
|
||||||
makedirs(destinationDirectory)
|
makedirs(destinationDirectory)
|
||||||
@@ -66,4 +66,4 @@ def lib_insinto(sourceFile, destinationDirectory, permission = 0644):
|
|||||||
if os.path.islink(sourceFile):
|
if os.path.islink(sourceFile):
|
||||||
os.symlink(os.path.realpath(sourceFile), os.path.join(destinationDirectory, sourceFile))
|
os.symlink(os.path.realpath(sourceFile), os.path.join(destinationDirectory, sourceFile))
|
||||||
else:
|
else:
|
||||||
os.system("install -m%s %s %s" % (permission, sourceFile, destinationDirectory))
|
os.system('install -m%s %s %s' % (permission, sourceFile, destinationDirectory))
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ import os
|
|||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
# Pisi Modules
|
||||||
|
from pisi.ui import ui
|
||||||
|
|
||||||
# ActionsAPI Modules
|
# ActionsAPI Modules
|
||||||
import get
|
import get
|
||||||
|
|
||||||
@@ -46,7 +49,7 @@ def unlinkDir(sourceDirectory):
|
|||||||
if can_access_directory(sourceDirectory):
|
if can_access_directory(sourceDirectory):
|
||||||
shutil.rmtree(sourceDirectory)
|
shutil.rmtree(sourceDirectory)
|
||||||
else:
|
else:
|
||||||
print "unlinkDir: remove failed..."
|
ui.error('unlinkDir: remove failed...')
|
||||||
|
|
||||||
def move(sourceFile, destinationFile):
|
def move(sourceFile, destinationFile):
|
||||||
'''recursively move a sourceFile or directory to destinationFile'''
|
'''recursively move a sourceFile or directory to destinationFile'''
|
||||||
@@ -78,3 +81,12 @@ def ls(source):
|
|||||||
def export(key, value):
|
def export(key, value):
|
||||||
os.environ[key] = value
|
os.environ[key] = value
|
||||||
|
|
||||||
|
def system(command):
|
||||||
|
p = os.popen(command)
|
||||||
|
while 1:
|
||||||
|
line = p.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
ui.debug(line)
|
||||||
|
|
||||||
|
p.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user