当前位置: 首页>>代码示例>>Python>>正文


Python utils.output函数代码示例

本文整理汇总了Python中utils.output函数的典型用法代码示例。如果您正苦于以下问题:Python output函数的具体用法?Python output怎么用?Python output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了output函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: configure

    def configure(self):
        if os.path.exists(
            os.path.join(self.build_dir, 'CMakeFiles/cmake.check_cache')):
            utils.output("vtkdevide build already configured.")
            return
        
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        cmake_params = "-DBUILD_SHARED_LIBS=ON " \
                       "-DBUILD_TESTING=OFF " \
                       "-DCMAKE_BUILD_TYPE=RelWithDebInfo " \
                       "-DCMAKE_INSTALL_PREFIX=%s " \
                       "-DVTK_DIR=%s " \
                       "-DDCMTK_INCLUDE_PATH=%s " \
                       "-DDCMTK_LIB_PATH=%s " \
                       "-DPYTHON_EXECUTABLE=%s " \
                       "-DPYTHON_LIBRARY=%s " \
                       "-DPYTHON_INCLUDE_PATH=%s" % \
                       (self.inst_dir, config.VTK_DIR,
                        config.DCMTK_INCLUDE, config.DCMTK_LIB,
                        config.PYTHON_EXECUTABLE,
                        config.PYTHON_LIBRARY,
                        config.PYTHON_INCLUDE_PATH)

        ret = utils.cmake_command(self.build_dir, self.source_dir,
                cmake_params)

        if ret != 0:
            utils.error("Could not configure vtkdevide.  Fix and try again.")
开发者ID:codester2,项目名称:devide.johannes,代码行数:30,代码来源:ip_vtkdevide.py

示例2: clean_build

 def clean_build(self):
     # nuke the build dir, the source dir is pristine
     utils.output("Removing build and installation directories.")
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     
     self.clean_install()
开发者ID:codester2,项目名称:devide.johannes,代码行数:7,代码来源:ip_pyqt.py

示例3: install

    def install(self):
        # to test for install, just do python -c "import scipy"
        # and test the result (we could just import directly, but that would
        # only work once our invoking python has been stopped and started
        # again)
        os.chdir(config.working_dir) # we need to be elsewhere!
        ret = os.system('%s -c "import scipy"' % (sys.executable,))
        if ret == 0:
            utils.output('scipy already installed.  Skipping step.')

        else:
            utils.output('ImportError test shows that scipy is not '
                         'installed.  Installing...')

            if os.name == 'posix':
                os.chdir(self.build_dir)
                
                ret = os.system('%s setup.py install' % (sys.executable,))
                
                if ret != 0:
                    utils.error('scipy install failed.  Please fix and try again.')

            elif os.name == 'nt':
                # unpack relevant ZIP into Python site-packages dir.
                from distutils import sysconfig
                spd = sysconfig.get_python_lib()

                # copy self.build_dir/PLATLIB/* to python/libs/site-packages/
                # we're not copying SCRIPTS/f2py.py
                pl_dir = os.path.join(self.build_dir, 'PLATLIB')
                utils.copy_glob(os.path.join(pl_dir, '*'), spd)
开发者ID:codester2,项目名称:devide.johannes,代码行数:31,代码来源:ip_scipy.py

示例4: configure

    def configure(self):
        if os.path.exists(
            os.path.join(self.build_dir, 'CMakeFiles/cmake.check_cache')):
            utils.output("vtktud build already configured.")
            return
        
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        cmake_params = "-DBUILD_SHARED_LIBS=ON " \
                       "-DBUILD_CONTRIB=OFF " \
                       "-DBUILD_TESTING=OFF " \
                       "-DCMAKE_BACKWARDS_COMPATIBILITY=2.6 " \
                       "-DCMAKE_BUILD_TYPE=RelWithDebInfo " \
                       "-DCMAKE_INSTALL_PREFIX=%s " \
                       "-DVTK_DIR=%s" % (self.inst_dir, config.VTK_DIR)

        # we only add this under posix as a work-around to compile the
        # STLib code under g++
        if os.name == 'posix':
            cmake_params = cmake_params + " -DCMAKE_CXX_FLAGS=-fpermissive "

        ret = utils.cmake_command(self.build_dir, self.source_dir,
                cmake_params)

        if ret != 0:
            utils.error("Could not configure vtktud.  Fix and try again.")
开发者ID:codester2,项目名称:devide.johannes,代码行数:27,代码来源:ip_vtktud.py

示例5: configure

    def configure(self):
        if os.path.exists(
            os.path.join(self.build_dir, 'CMakeFiles/cmake.check_cache')):
            utils.output("wrapitk build already configured.")
            return
        
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        # need unsigned short for itkPyImageFilter
        # with the switches below, I need /bigobj on win64 for the
        # following projects: ITKPyBasePython
        cmake_params = \
                "-DBUILD_TESTING=OFF " \
                "-DCMAKE_BUILD_TYPE=RelWithDebInfo " \
                "-DCMAKE_INSTALL_PREFIX=%s " \
                "-DINSTALL_WRAP_ITK_COMPATIBILITY=NO " \
                "-DITK_DIR=%s " \
                "-DITK_TEST_DRIVER=%s " \
                "-DCableSwig_DIR=%s " \
                "-DSWIG_DIR=%s " \
                "-DSWIG_EXECUTABLE=%s " \
                "-DVTK_DIR=%s " \
                "-DWRAP_ITK_PYTHON=ON " \
                "-DWRAP_complex_double=OFF " \
                "-DWRAP_complex_float=ON " \
                "-DWRAP_covariant_vector_double=OFF " \
                "-DWRAP_covariant_vector_float=ON " \
                "-DWRAP_double=OFF " \
                "-DWRAP_float=ON " \
                "-DWRAP_rgb_unsigned_char=OFF " \
                "-DWRAP_rgb_unsigned_short=ON " \
                "-DWRAP_rgba_unsigned_char=OFF " \
                "-DWRAP_rgba_unsigned_short=OFF " \
                "-DWRAP_signed_char=OFF " \
                "-DWRAP_signed_long=OFF " \
                "-DWRAP_signed_short=ON " \
                "-DWRAP_unsigned_char=OFF " \
                "-DWRAP_unsigned_long=OFF " \
                "-DWRAP_unsigned_short=ON " \
                "-DWRAP_vector_double=OFF " \
                "-DWRAP_vector_float=ON " \
                "-DPYTHON_EXECUTABLE=%s " \
                "-DPYTHON_LIBRARY=%s " \
                "-DPYTHON_INCLUDE_PATH=%s " % \
                (self.inst_dir, config.ITK_DIR,
                 config.ITK_TEST_DRIVER,
                 config.CABLESWIG_DIR,
                 config.SWIG_DIR,
                 config.SWIG_EXECUTABLE, config.VTK_DIR,
                 config.PYTHON_EXECUTABLE,
                 config.PYTHON_LIBRARY,
                 config.PYTHON_INCLUDE_PATH)


        ret = utils.cmake_command(self.build_dir, self.source_dir,
                cmake_params)

        if ret != 0:
            utils.error("Could not configure WrapITK.  Fix and try again.")
开发者ID:codester2,项目名称:devide.johannes,代码行数:60,代码来源:ip_wrapitk.py

示例6: get

 def get(self):
     if os.path.exists(self.tbfilename):
         utils.output("%s already present, not downloading." %
                      (SCIPY_ARCHIVE,))
     else:
         utils.goto_archive()
         utils.urlget(SCIPY_URL, SCIPY_ARCHIVE)
开发者ID:codester2,项目名称:devide.johannes,代码行数:7,代码来源:ip_scipy.py

示例7: get

    def get(self):
        if os.path.exists(self.source_dir):
            utils.output("ITK already checked out, skipping step.")

        else:
            utils.goto_archive()

            ret = os.system("git clone %s %s" % (GIT_REPO, BASENAME))
            if ret != 0:
                utils.error("Could not clone ITK repo.  Fix and try again.")

            os.chdir(self.source_dir)
            # FIXME: error checking
            ret = os.system("git submodule update --init")

            ret = os.system("git checkout %s" % (GIT_TAG,))
            if ret != 0:
                utils.error("Could not checkout ITK 4.0.0. Fix and try again.")

            # FIXME: error checking
            ret = os.system("git submodule update")

        # also the source dir for other installpackages that wish to build
        # WrapITK external projects
        # itkvtkglue needs this during its get() stage!
        config.WRAPITK_SOURCE_DIR = os.path.join(self.source_dir,
                                            'Wrapping/WrapITK')

        # now apply patch if necessary
        # only on win64
        if config.WINARCH_STR != "x64":
            return
开发者ID:codester2,项目名称:devide.johannes,代码行数:32,代码来源:ip_itk_40.py

示例8: install

    def install(self):
        config.WRAPITK_TOPLEVEL = self.inst_dir
        # this dir contains the WrapITK cmake config (WrapITKConfig.cmake)
        config.WRAPITK_DIR = os.path.join(
                self.inst_dir, 'lib', 'InsightToolkit', 'WrapITK')
        # contains all WrapITK shared objects / libraries
        config.WRAPITK_LIB = os.path.join(config.WRAPITK_DIR, 'lib')
        # contains itk.py
        config.WRAPITK_PYTHON = os.path.join(config.WRAPITK_DIR, 'Python')
        # subsequent wrapitk components will need this
        config.WRAPITK_SOURCE_DIR = self.source_dir

        posix_file = os.path.join(
                config.WRAPITK_LIB, '_RegistrationPython.so')
        nt_file = os.path.join(
                config.WRAPITK_LIB, '_RegistrationPython' + config.PYE_EXT)

        if utils.file_exists(posix_file, nt_file):
            utils.output("WrapITK already installed, skipping step.")
        else:
            os.chdir(self.build_dir)
            ret = utils.make_command('WrapITK.sln', install=True)

            if ret != 0:
                utils.error(
                "Could not install WrapITK.  Fix and try again.")
开发者ID:codester2,项目名称:devide.johannes,代码行数:26,代码来源:ip_wrapitk.py

示例9: main

def main():

    args = process_command_line()
    api_resource_key, api_resource_value = args.api_resource

    client = query_client.OpenVulnQueryClient(config.CLIENT_ID, config.CLIENT_SECRET)
    query_client_func = getattr(client, 'get_by_{0}'.format(api_resource_key))
    if not args.advisory_format:
        advisories = query_client_func(api_resource_value)
    else:
        if api_resource_key in constants.allows_filter:
            filter = query_client.Filter()
            if args.first_published:
                start_date, end_date = args.first_published
                filter = query_client.FirstPublishedFilter(start_date, end_date)
            elif args.last_published:
                start_date, end_date = args.last_published
                filter = query_client.LastPublishedFilter(start_date, end_date)
            advisories = query_client_func(args.advisory_format, api_resource_value, filter)
        else:
            advisories = query_client_func(args.advisory_format, api_resource_value)

    returned_output = None
    if args.fields:
        if args.count:
            returned_output = [utils.count_fields(advisories, args.fields)]
        else:
            returned_output = utils.filter_advisories(advisories, args.fields)
    else:
        returned_output = utils.filter_advisories(advisories, constants.API_LABELS)

    output_format, file_path = args.output_format

    with utils.get_output_filehandle(file_path) as f:
        utils.output(returned_output, output_format, f)
开发者ID:iamparas,项目名称:openVulnAPI,代码行数:35,代码来源:main.py

示例10: get

    def get(self):
        if os.path.exists(self.source_dir):
            utils.output("VTK already checked out, skipping step.")

        else:
            utils.goto_archive()

            ret = os.system("git clone %s %s" % (GIT_REPO, BASENAME))
            if ret != 0:
                utils.error("Could not clone VTK repo.  Fix and try again.")

            os.chdir(self.source_dir)
            ret = os.system("git checkout %s" % (GIT_TAG,))
            if ret != 0:
                utils.error("Could not checkout VTK %s. Fix and try again." % (GIT_TAG,))


        if not os.path.exists(self.exc_patch_dst):
            utils.output("Applying EXC patch")
            # we do this copy so we can see if the patch has been done yet or not
            shutil.copyfile(self.exc_patch_src, self.exc_patch_dst)

            os.chdir(self.source_dir)
            # default git-generated patch, so needs -p1
            ret = os.system(
                "%s -p1 < %s" % (config.PATCH, self.exc_patch_dst))

            if ret != 0:
                utils.error(
                    "Could not apply EXC patch.  Fix and try again.")
开发者ID:codester2,项目名称:devide.johannes,代码行数:30,代码来源:ip_vtk58.py

示例11: install

    def install(self):
        # to test for install, just do python -c "import matplotlib"
        # and test the result (we could just import directly, but that would
        # only work once our invoking python has been stopped and started
        # again)
        os.chdir(config.archive_dir) # we need to be elsewhere!
        ret = os.system('%s -c "import matplotlib"' % (sys.executable,))
        if ret == 0:
            utils.output('matplotlib already installed.  Skipping step.')

        else:
            utils.output('ImportError test shows that matplotlib is not '
                         'installed.  Installing...')

            if os.name == 'nt':
                self.install_nt()
            else:
                self.install_posix()

            # make sure the backend is set to WXAgg
            # and that interactive is set to True
            rcfn = os.path.join(
                    config.PYTHON_SITE_PACKAGES,
                    'matplotlib', 'mpl-data', 'matplotlibrc')
            utils.re_sub_filter_file(
                    [("(\s*backend\s*\:).*", "\\1 WXAgg"),
                     ("#*(\s*interactive\s:).*","\\1 True")], rcfn)
开发者ID:codester2,项目名称:devide.johannes,代码行数:27,代码来源:ip_matplotlib.py

示例12: install

    def install(self):
        posix_file = os.path.join(self.inst_dir, 'bin/vtkpython')
        nt_file = os.path.join(self.inst_dir, 'bin', 'vtkpython.exe')

        if utils.file_exists(posix_file, nt_file):    
            utils.output("VTK already installed.  Skipping build step.")

        else:
            # python 2.5.2 setup.py complains that this does not exist
            # with VTK PV-3-2-1.  This is only on installations with
            # EasyInstall / Python Eggs, then the VTK setup.py uses
            # EasyInstall and not standard distutils.  gah!
            if not os.path.exists(config.VTK_PYTHON):
                os.makedirs(config.VTK_PYTHON)

            os.chdir(self.build_dir)

            # we save, set and restore the PP env variable, else
            # stupid setuptools complains
            save_env = os.environ.get('PYTHONPATH', '')
            os.environ['PYTHONPATH'] = config.VTK_PYTHON
            ret = utils.make_command('VTK.sln', install=True)
            os.environ['PYTHONPATH'] = save_env

            if ret != 0:
                utils.error("Could not install VTK.  Fix and try again.")
开发者ID:codester2,项目名称:devide.johannes,代码行数:26,代码来源:ip_vtk.py

示例13: configure

    def configure(self):
        if os.path.exists(
            os.path.join(self.build_dir, 'CMakeFiles/cmake.check_cache')):
            utils.output("ITK build already configured.")
            return
        
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        # ITK_USE_REVIEW *must* be on for ItkVtkGlue to work!
        # following types are wrapped:
        # complex_float, float, signed_short, unsigned long,
        # vector_float 
        # I've removed "-DITK_USE_REVIEW_STATISTICS=ON " 
        # for now, as this seems to cause problems on win64
        cmake_params = "-DBUILD_EXAMPLES=OFF " \
                       "-DBUILD_SHARED_LIBS=ON " \
                       "-DBUILD_TESTING=OFF " \
                       "-DCMAKE_BUILD_TYPE=RelWithDebInfo " \
                       "-DCMAKE_INSTALL_PREFIX=%s " \
                       "-DITK_USE_REVIEW=ON " \
                       "-DITK_USE_ORIENTED_IMAGE_DIRECTION=ON " \
                       "-DITK_IMAGE_BEHAVES_AS_ORIENTED_IMAGE=ON " \
                       "_DITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY=ON " \
                                              % (self.inst_dir,)
        
        ret = utils.cmake_command(self.build_dir, self.source_dir,
                cmake_params)

        if ret != 0:
            utils.error("Could not configure ITK.  Fix and try again.")
开发者ID:codester2,项目名称:devide.johannes,代码行数:31,代码来源:ip_itk.py

示例14: get

    def get(self):
        if os.path.exists(self.source_dir):
            utils.output("ITK already checked out, skipping step.")

        else:
            os.chdir(config.archive_dir)
            ret = os.system("%s -d %s co %s %s" %
                            (config.CVS, CVS_REPO, CVS_VERSION, BASENAME))
            
            if ret != 0:
                utils.error("Could not CVS checkout ITK.  Fix and try again.")

        # also the source dir for other installpackages that wish to build
        # WrapITK external projects
        # itkvtkglue needs this during its get() stage!
        config.WRAPITK_SOURCE_DIR = os.path.join(self.source_dir,
                                            'Wrapping/WrapITK')

        # now apply patch if necessary
        # only on win64
        if config.WINARCH_STR != "x64":
            return

        patch_dst = os.path.join(config.archive_dir, W64SWIG_PATCH)
        if not os.path.exists(patch_dst):
            utils.output("Applying PATCH: win64 swig vs 2008 workaround")
            patch_src = os.path.join(config.patches_dir,W64SWIG_PATCH)
            shutil.copy(patch_src, patch_dst)
            os.chdir(self.source_dir)
            ret = os.system("%s -p0 < %s" % (config.PATCH, patch_dst))
开发者ID:codester2,项目名称:devide.johannes,代码行数:30,代码来源:ip_itk.py

示例15: clean_build

    def clean_build(self):
        utils.output("Removing build and installation directories.")
        if os.path.exists(self.inst_dir):
            shutil.rmtree(self.inst_dir)

        if os.path.exists(self.build_dir):
            shutil.rmtree(self.build_dir)
开发者ID:codester2,项目名称:devide.johannes,代码行数:7,代码来源:ip_cableswig.py


注:本文中的utils.output函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。