ActionsAPI içinde düzenlemeler, dosed native python'a çevrildi. Sonuç olarak bash içinde RegularExpr. magic var kendileri de birazdan commit edilecek. Bu regular exp. denen illet acayip birşey...
This commit is contained in:
@@ -5,7 +5,11 @@
|
|||||||
import os
|
import os
|
||||||
import gzip
|
import gzip
|
||||||
import shutil
|
import shutil
|
||||||
|
import fileinput
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from utils import makedirs
|
||||||
from pisi.util import copy_file
|
from pisi.util import copy_file
|
||||||
|
|
||||||
# actions api modules
|
# actions api modules
|
||||||
@@ -19,12 +23,9 @@ def dodoc(*documentList):
|
|||||||
+ env.src_version + '-' \
|
+ env.src_version + '-' \
|
||||||
+ env.src_release
|
+ env.src_release
|
||||||
|
|
||||||
try:
|
makedirs(os.path.join(env.install_dir,
|
||||||
os.makedirs(os.path.join(env.install_dir,
|
|
||||||
dirs.doc,
|
dirs.doc,
|
||||||
srcTag))
|
srcTag))
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
for document in documentList:
|
for document in documentList:
|
||||||
if os.access(document, os.F_OK):
|
if os.access(document, os.F_OK):
|
||||||
@@ -34,18 +35,15 @@ def dodoc(*documentList):
|
|||||||
srcTag,
|
srcTag,
|
||||||
os.path.basename(document)))
|
os.path.basename(document)))
|
||||||
|
|
||||||
def dosed(filename, *sedPattern):
|
def dosed(filename, searchPattern, replacePattern = ''):
|
||||||
#FIXME: Convert to python
|
for line in fileinput.input(filename, inplace = 1):
|
||||||
for pattern in sedPattern:
|
line = re.sub(searchPattern, replacePattern, line)
|
||||||
os.system('sed -i -e \'' + pattern + '\' ' + filename)
|
sys.stdout.write(line)
|
||||||
|
|
||||||
def dosbin(filename, destination=glb.dirs.sbin):
|
def dosbin(filename, destination=glb.dirs.sbin):
|
||||||
env = glb.env
|
env = glb.env
|
||||||
|
|
||||||
try:
|
makedirs(os.path.join(env.install_dir, destination))
|
||||||
os.makedirs(os.path.join(env.install_dir, destination))
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if os.access(filename, os.F_OK):
|
if os.access(filename, os.F_OK):
|
||||||
copy_file(filename,
|
copy_file(filename,
|
||||||
@@ -59,10 +57,8 @@ def doman(filename):
|
|||||||
|
|
||||||
man, postfix = filename.split('.')
|
man, postfix = filename.split('.')
|
||||||
destDir = os.path.join(env.install_dir, dirs.man, "man" + postfix)
|
destDir = os.path.join(env.install_dir, dirs.man, "man" + postfix)
|
||||||
try:
|
|
||||||
os.makedirs(destDir)
|
makedirs(destDir)
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
gzfile = gzip.GzipFile(filename + '.gz', 'w', 9)
|
gzfile = gzip.GzipFile(filename + '.gz', 'w', 9)
|
||||||
gzfile.writelines(file(filename).xreadlines())
|
gzfile.writelines(file(filename).xreadlines())
|
||||||
@@ -75,19 +71,14 @@ def doman(filename):
|
|||||||
def domove(source, destination):
|
def domove(source, destination):
|
||||||
env = glb.env
|
env = glb.env
|
||||||
|
|
||||||
try:
|
makedirs(env.install_dir + '/' + os.path.dirname(destination))
|
||||||
os.makedirs(env.install_dir + '/' + os.path.dirname(destination))
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
shutil.move(env.install_dir + '/' + source, env.install_dir + '/' + destination)
|
shutil.move(env.install_dir + '/' + source, env.install_dir + '/' + destination)
|
||||||
|
|
||||||
def dosym(source, destination):
|
def dosym(source, destination):
|
||||||
env = glb.env
|
env = glb.env
|
||||||
|
|
||||||
try:
|
makedirs( env.install_dir + '/' + os.path.dirname(destination))
|
||||||
os.makedirs( env.install_dir + '/' + os.path.dirname(destination))
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
if not os.path.islink(env.install_dir + destination):
|
||||||
os.symlink(source, env.install_dir + destination)
|
os.symlink(source, env.install_dir + destination)
|
||||||
|
|||||||
@@ -19,3 +19,9 @@ def createTmpDir():
|
|||||||
|
|
||||||
def chmod(filename, mode = 0755):
|
def chmod(filename, mode = 0755):
|
||||||
os.chmod(filename, mode)
|
os.chmod(filename, mode)
|
||||||
|
|
||||||
|
def makedirs(directoryName):
|
||||||
|
try:
|
||||||
|
os.makedirs(directoryName)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user