當前位置: 首頁>>代碼示例>>Python>>正文


Python errors.UnknownFileError方法代碼示例

本文整理匯總了Python中distutils.errors.UnknownFileError方法的典型用法代碼示例。如果您正苦於以下問題:Python errors.UnknownFileError方法的具體用法?Python errors.UnknownFileError怎麽用?Python errors.UnknownFileError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在distutils.errors的用法示例。


在下文中一共展示了errors.UnknownFileError方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: object_filenames

# 需要導入模塊: from distutils import errors [as 別名]
# 或者: from distutils.errors import UnknownFileError [as 別名]
def object_filenames (self,
                          source_filenames,
                          strip_dir=0,
                          output_dir=''):
        if output_dir is None: output_dir = ''
        obj_names = []
        for src_name in source_filenames:
            # use normcase to make sure '.rc' is really '.rc' and not '.RC'
            (base, ext) = os.path.splitext (os.path.normcase(src_name))
            if ext not in (self.src_extensions + ['.rc','.res']):
                raise UnknownFileError, \
                      "unknown file type '%s' (from '%s')" % \
                      (ext, src_name)
            if strip_dir:
                base = os.path.basename (base)
            if ext == '.res' or ext == '.rc':
                # these need to be compiled to object files
                obj_names.append (os.path.join (output_dir,
                                            base + ext + self.obj_extension))
            else:
                obj_names.append (os.path.join (output_dir,
                                            base + self.obj_extension))
        return obj_names

    # object_filenames ()

# class CygwinCCompiler


# the same as cygwin plus some additional parameters 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:32,代碼來源:cygwinccompiler.py

示例2: object_filenames

# 需要導入模塊: from distutils import errors [as 別名]
# 或者: from distutils.errors import UnknownFileError [as 別名]
def object_filenames (self,
                          source_filenames,
                          strip_dir=0,
                          output_dir=''):
        if output_dir is None: output_dir = ''
        obj_names = []
        for src_name in source_filenames:
            # use normcase to make sure '.rc' is really '.rc' and not '.RC'
            (base, ext) = os.path.splitext (os.path.normcase(src_name))
            if ext not in (self.src_extensions + ['.rc']):
                raise UnknownFileError, \
                      "unknown file type '%s' (from '%s')" % \
                      (ext, src_name)
            if strip_dir:
                base = os.path.basename (base)
            if ext == '.rc':
                # these need to be compiled to object files
                obj_names.append (os.path.join (output_dir,
                                            base + self.res_extension))
            else:
                obj_names.append (os.path.join (output_dir,
                                            base + self.obj_extension))
        return obj_names

    # object_filenames ()

    # override the find_library_file method from UnixCCompiler
    # to deal with file naming/searching differences 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:30,代碼來源:emxccompiler.py

示例3: object_filenames

# 需要導入模塊: from distutils import errors [as 別名]
# 或者: from distutils.errors import UnknownFileError [as 別名]
def object_filenames (self,
                          source_filenames,
                          strip_dir=0,
                          output_dir=''):
        if output_dir is None: output_dir = ''
        obj_names = []
        for src_name in source_filenames:
            # FIXME: "bogus checks for suffix" - as example the commented
            # by #BOGUS# code break valid assembler suffix ".S" !
            #BOGUS## use normcase to make sure '.rc' is really '.rc' and not '.RC'
            #BOGUS#base, ext = os.path.splitext(os.path.normcase(src_name))
            base, ext = os.path.splitext (src_name)
            ext_normcase = os.path.normcase(ext)
            if ext_normcase in ['.rc','.res']:
                ext = ext_normcase
            if ext not in (self.src_extensions + ['.rc','.res']):
                raise UnknownFileError, \
                      "unknown file type '%s' (from '%s')" % \
                      (ext, src_name)
            base = os.path.splitdrive(base)[1] # Chop off the drive
            base = base[os.path.isabs(base):]  # If abs, chop off leading /
            if strip_dir:
                base = os.path.basename (base)
            if ext == '.res' or ext == '.rc':
                # these need to be compiled to object files
                obj_names.append (os.path.join (output_dir,
                                            base + ext + self.obj_extension))
            else:
                obj_names.append (os.path.join (output_dir,
                                            base + self.obj_extension))
        return obj_names

    # object_filenames ()

# class CygwinCCompiler


# the same as cygwin plus some additional parameters 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:40,代碼來源:cygwinccompiler.py

示例4: object_filenames

# 需要導入模塊: from distutils import errors [as 別名]
# 或者: from distutils.errors import UnknownFileError [as 別名]
def object_filenames (self,
                          source_filenames,
                          strip_dir=0,
                          output_dir=''):
        if output_dir is None: output_dir = ''
        obj_names = []
        for src_name in source_filenames:
            # use normcase to make sure '.rc' is really '.rc' and not '.RC'
            (base, ext) = os.path.splitext (os.path.normcase(src_name))

            # added these lines to strip off windows drive letters
            # without it, .o files are placed next to .c files
            # instead of the build directory
            drv, base = os.path.splitdrive(base)
            if drv:
                base = base[1:]

            if ext not in (self.src_extensions + ['.rc', '.res']):
                raise UnknownFileError(
                      "unknown file type '%s' (from '%s')" % \
                      (ext, src_name))
            if strip_dir:
                base = os.path.basename (base)
            if ext == '.res' or ext == '.rc':
                # these need to be compiled to object files
                obj_names.append (os.path.join (output_dir,
                                                base + ext + self.obj_extension))
            else:
                obj_names.append (os.path.join (output_dir,
                                                base + self.obj_extension))
        return obj_names

    # object_filenames () 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:35,代碼來源:mingw32ccompiler.py


注:本文中的distutils.errors.UnknownFileError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。