moving sameFilesystem to utils.py

This commit is contained in:
Martin A. Brown 2016-03-08 09:45:54 -08:00
parent ea2139373c
commit 7aa99ec502
2 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,8 @@ from tldp.sources import SourceDocument, arg_issourcedoc
from tldp.outputs import OutputDirectory
from tldp.inventory import Inventory, status_classes, status_types, stypes
from tldp.config import collectconfiguration
from tldp.utils import arg_isloglevel, arg_isdirectory, swapdirs
from tldp.utils import arg_isloglevel, arg_isdirectory
from tldp.utils import swapdirs, sameFilesystem
from tldp.doctypes.common import preamble, postamble
logformat = '%(levelname)-9s %(name)s %(filename)s#%(lineno)s ' \
@ -39,7 +40,6 @@ ERR_UNKNOWNARGS = "Unknown arguments received: "
ERR_EXTRAARGS = "Extra arguments received: "
def show_doctypes(config, *args, **kwargs):
if args:
return ERR_EXTRAARGS + ' '.join(args)
@ -368,10 +368,6 @@ def extractExplicitDocumentArgs(config, args):
return docs, remainder
def sameFilesystem(d0, d1):
return os.stat(d0).st_dev == os.stat(d1).st_dev
def collectWorkset(config, args):
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# -- argument handling logic; try to avoid creating an inventory unless it

View File

@ -75,6 +75,10 @@ def arg_isexecutable(f):
return None
def sameFilesystem(d0, d1):
return os.stat(d0).st_dev == os.stat(d1).st_dev
def stem_and_ext(name):
'''return (stem, ext) for any relative or absolute filename'''
return os.path.splitext(os.path.basename(os.path.normpath(name)))