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


Python System.check_package方法代码示例

本文整理汇总了Python中System.check_package方法的典型用法代码示例。如果您正苦于以下问题:Python System.check_package方法的具体用法?Python System.check_package怎么用?Python System.check_package使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


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

示例1: jslint

# 需要导入模块: import System [as 别名]
# 或者: from System import check_package [as 别名]
def jslint(files, fix = False, relax = False, fail = True):
    System.check_package('java')

    files = FileList.check(files)

    options = []
    command = ""

    options.append('--jslint_error=optional_type_marker')
    options.append('--jslint_error=blank_lines_at_top_level')
    options.append('--jslint_error=indentation')
    options.append('--custom_jsdoc_tags=homepage,version,ignore,returns,example,function,requires,name,namespace,property,static,constant,default,location,copyright,memberOf,lends,fileOverview')


    if fix == True:
        header = "Fix JS lint"
        command = "fixjsstyle %s %s "  % (  ' '.join(options) , ' '.join(files))
    else:
        header = "JS lint"
        command = "gjslint %s %s "  % (  ' '.join(options) , ' '.join(files))
    
    if relax == True:
        command += ' | grep -v "Line too long"'
    result = sh(command, header = "%s (%s files)" % (header, len(files)) )

    error = re.search('Found\s([0-9]+)\serrors', result)

    if fail and error:
        console.fail( ' :puke:\n' + error.group())
开发者ID:fdev31,项目名称:puke,代码行数:31,代码来源:Tools.py

示例2: jsdoc3

# 需要导入模块: import System [as 别名]
# 或者: from System import check_package [as 别名]
def jsdoc3(files, destination, template = None, fail = True):
    System.check_package('java')

    files = FileList.check(files)

    redirect = ''

    if not template:
        template = "templates/gristaupe"

    if template == "templates/gristaupe":
        redirect = destination
        destination = "console"

    jsdoc =  os.path.join(__get_datas_path(), 'jsdoc3')
    out = Std()
    output = sh('cd "%s"; java -classpath lib/js.jar org.mozilla.javascript.tools.shell.Main -debug -modules nodejs_modules -modules rhino_modules -modules . jsdoc.js\
      --destination "%s" --template "%s" %s' % (jsdoc, destination, template, '"' + '" "'.join(files) + '"'), header = "Generating js doc v3", output = False, std = out)

    if fail and out.code:
        console.fail(out.err)
    
    if template == "templates/gristaupe":
        writefile(redirect, out.out);
        console.confirm('  JSON Doc generated in "%s"' % redirect)
    else:
        console.confirm('  JSON Doc generated in "%s"' % destination)

    return out.out
开发者ID:etabard,项目名称:puke,代码行数:31,代码来源:Tools.py

示例3: jslint

# 需要导入模块: import System [as 别名]
# 或者: from System import check_package [as 别名]
def jslint(files, fix = False, relax = False, fail = True):
    System.check_package('java')

    files = FileList.check(files)

    options = []
    command = ""

    options.append('--jslint_error=optional_type_marker')
    options.append('--jslint_error=blank_lines_at_top_level')
    options.append('--jslint_error=indentation')
    # This covers jsdoctoolkit 2
    tags = '--custom_jsdoc_tags=homepage,version,ignore,returns,example,function,requires,name,namespace,property,static,constant,default,location,copyright,memberOf,lends,fileOverview'
    # This covers jsdoc3 as well
    tags += ',module,abstract,file,kind,summary,description,event,exception,exports,fires,global,inner,instance,member,var,memberof,mixes,mixin,arg,argument,readonly,since,todo,public'
    options.append(tags)

    if fix == True:
        header = "Fix JS lint"
        command = "fixjsstyle %s %s "  % (  ' '.join(options) , ' '.join(files))
    else:
        header = "JS lint"
        command = "gjslint %s %s "  % (  ' '.join(options) , ' '.join(files))
    
    if relax == True:
        command += ' | grep -v "Line too long"'
    result = sh(command, header = "%s (%s files)" % (header, len(files)) )

    error = re.search('Found\s([0-9]+)\serrors', result)

    if fail and error:
        console.fail( ' :puke:\n' + error.group())
开发者ID:etabard,项目名称:puke,代码行数:34,代码来源:Tools.py

示例4: jsdoc

# 需要导入模块: import System [as 别名]
# 或者: from System import check_package [as 别名]
def jsdoc(files, folder, template = None, fail = True):
    System.check_package('java')

    files = FileList.check(files)

    if not template:
        template = "%s/templates/gris_taupe" % jsdoc

    jsdoc =  os.path.join(__get_datas_path(), 'jsdoc-toolkit')
    output = sh("java -jar %s/jsrun.jar %s/app/run.js -d=%s -t=%s -a  %s" % (jsdoc, jsdoc, folder, template, ' '.join(files)), header = "Generating js doc", output = True)

    if fail and output:
        console.fail(output)
    
    console.confirm('  Doc generated in "%s"' % folder)
开发者ID:fdev31,项目名称:puke,代码行数:17,代码来源:Tools.py

示例5: minify

# 需要导入模块: import System [as 别名]
# 或者: from System import check_package [as 别名]
def minify(in_file, out_file = None, verbose=False):

    System.check_package('java')

    if not isinstance(in_file, str):
        raise Exception("Minify : single file only")

    if not out_file:
        out_file = in_file
    
    in_type = __get_ext(out_file)

    org_size = os.path.getsize(in_file)

    console.header('- Minifying %s (%.2f kB)' % (__pretty(in_file), org_size / 1024.0))

    if in_type == 'js':
        __minify_js(in_file, out_file + '.tmp', verbose)
    else:
        __minify_css(in_file, out_file + '.tmp', verbose)
    
    copyfile(out_file + '.tmp', out_file)
    os.remove(out_file + '.tmp')

    new_size = os.path.getsize(out_file)

    #avoid division by zero
    if not new_size:
        console.fail('Compression fail')

    
    console.info('  ~ Original: %.2f kB' % (org_size / 1024.0))
    console.info('  ~ Compressed: %.2f kB' % (new_size / 1024.0))
    
    if not org_size:
        return

    console.confirm('  %s ( Reduction : %.1f%% )' % (out_file, (float(org_size - new_size) / org_size * 100)))
开发者ID:fdev31,项目名称:puke,代码行数:40,代码来源:Tools.py

示例6: create

# 需要导入模块: import System [as 别名]
# 或者: from System import check_package [as 别名]
	def create(self, path, python = "python", force = False):

		console.header(' * Creating env "%s" ...' % (path))
		if not force and exists(os.path.join(path, 'bin', 'activate')):
			self.__path = path
			console.confirm('   Env "%s" already created. Use "force=True" to override it' % path)
			return True

		check = System.check_package('virtualenv')
		version = System.get_package_version(python)
		console.log('   Python version : %s ...' % version)

		

		result = sh("virtualenv -p %s %s --no-site-packages " % (python, path), header = False, output = False)
		console.debug(result)

		console.confirm('   Env "%s"  created' % path)
		self.__path = path
开发者ID:etabard,项目名称:puke,代码行数:21,代码来源:VirtualEnv.py


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