insinto symde takip edebilsin, kahrol firefox
This commit is contained in:
@@ -203,16 +203,16 @@ def dosym(sourceFile, destinationFile):
|
|||||||
except OSError:
|
except OSError:
|
||||||
error(_('ActionsAPI [dosym]: File exists: %s') % (sourceFile))
|
error(_('ActionsAPI [dosym]: File exists: %s') % (sourceFile))
|
||||||
|
|
||||||
def insinto(destinationDirectory, sourceFile, destinationFile = ''):
|
def insinto(destinationDirectory, sourceFile, destinationFile = '', sym = True):
|
||||||
'''insert a sourceFile into destinationDirectory as a destinationFile with same uid/guid/permissions'''
|
'''insert a sourceFile into destinationDirectory as a destinationFile with same uid/guid/permissions'''
|
||||||
makedirs(join_path(get.installDIR(), destinationDirectory))
|
makedirs(join_path(get.installDIR(), destinationDirectory))
|
||||||
|
|
||||||
if not destinationFile:
|
if not destinationFile:
|
||||||
for filePath in glob.glob(sourceFile):
|
for filePath in glob.glob(sourceFile):
|
||||||
if can_access_file(filePath):
|
if can_access_file(filePath):
|
||||||
copy(filePath, join_path(get.installDIR(), join_path(destinationDirectory, os.path.basename(filePath))))
|
copy(filePath, join_path(get.installDIR(), join_path(destinationDirectory, os.path.basename(filePath))), sym)
|
||||||
else:
|
else:
|
||||||
copy(sourceFile, join_path(get.installDIR(), join_path(destinationDirectory, destinationFile)))
|
copy(sourceFile, join_path(get.installDIR(), join_path(destinationDirectory, destinationFile)), sym)
|
||||||
|
|
||||||
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'''
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ def move(source, destination):
|
|||||||
else:
|
else:
|
||||||
error(_('ActionsAPI [move]: File %s doesn\'t exists.') % (filePath))
|
error(_('ActionsAPI [move]: File %s doesn\'t exists.') % (filePath))
|
||||||
|
|
||||||
def copy(source, destination):
|
def copy(source, destination, sym = True):
|
||||||
'''recursively copy a "source" file or directory to "destination"'''
|
'''recursively copy a "source" file or directory to "destination"'''
|
||||||
for filePath in glob.glob(source):
|
for filePath in glob.glob(source):
|
||||||
if isFile(filePath) and not isLink(filePath):
|
if isFile(filePath) and not isLink(filePath):
|
||||||
@@ -130,15 +130,17 @@ def copy(source, destination):
|
|||||||
shutil.copy(filePath, destination)
|
shutil.copy(filePath, destination)
|
||||||
except IOError:
|
except IOError:
|
||||||
error(_('ActionsAPI [copy]: Permission denied: %s to %s') % (filePath, destination))
|
error(_('ActionsAPI [copy]: Permission denied: %s to %s') % (filePath, destination))
|
||||||
elif isLink(filePath):
|
elif isLink(filePath) and sym:
|
||||||
if isDirectory(destination):
|
if isDirectory(destination):
|
||||||
os.symlink(os.readlink(filePath), join_path(destination, os.path.basename(filePath)))
|
os.symlink(os.readlink(filePath), join_path(destination, os.path.basename(filePath)))
|
||||||
else:
|
else:
|
||||||
if isFile(destination):
|
if isFile(destination):
|
||||||
os.remove(destination)
|
os.remove(destination)
|
||||||
os.symlink(os.readlink(filePath), destination)
|
os.symlink(os.readlink(filePath), destination)
|
||||||
|
elif isLink(filePath) and not sym:
|
||||||
|
shutil.copy(os.readlink(filePath), destination)
|
||||||
elif isDirectory(filePath):
|
elif isDirectory(filePath):
|
||||||
copytree(filePath, destination)
|
copytree(filePath, destination, sym)
|
||||||
else:
|
else:
|
||||||
error(_('ActionsAPI [copy]: File %s does not exist.') % filePath)
|
error(_('ActionsAPI [copy]: File %s does not exist.') % filePath)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user