本文整理汇总了Python中static_precompiler.utils.run_command函数的典型用法代码示例。如果您正苦于以下问题:Python run_command函数的具体用法?Python run_command怎么用?Python run_command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_command函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: compile_file
def compile_file(self, source_path):
full_source_path = self.get_full_source_path(source_path)
full_output_path = self.get_full_output_path(source_path)
args = [
self.executable,
]
if self.is_sourcemap_enabled:
args.append("-m")
args.extend([
full_source_path,
"-o", os.path.dirname(full_output_path),
])
full_output_dirname = os.path.dirname(full_output_path)
if not os.path.exists(full_output_dirname):
os.makedirs(full_output_dirname)
# `cwd` is a directory containing `source_path`.
# Ex: source_path = '1/2/3', full_source_path = '/abc/1/2/3' -> cwd = '/abc'
cwd = os.path.normpath(os.path.join(full_source_path, *([".."] * len(source_path.split("/")))))
out, errors = utils.run_command(args, cwd=cwd)
if errors:
raise exceptions.StaticCompilationError(errors)
utils.convert_urls(full_output_path, source_path)
if self.is_sourcemap_enabled:
utils.fix_sourcemap(full_output_path + ".map", source_path, full_output_path)
return self.get_output_path(source_path)
开发者ID:avsd,项目名称:django-static-precompiler,代码行数:31,代码来源:stylus.py
示例2: compile_file
def compile_file(self, source_path):
full_source_path = self.get_full_source_path(source_path)
full_output_path = self.get_full_output_path(source_path)
# `cwd` is a directory containing `source_path`.
# Ex: source_path = '1/2/3', full_source_path = '/abc/1/2/3' -> cwd = '/abc'
cwd = os.path.normpath(os.path.join(full_source_path, *([".."] * len(source_path.split("/")))))
args = [self.executable]
if self.is_sourcemap_enabled:
args.extend(["--source-map"])
if self.global_vars:
for variable_name, variable_value in self.global_vars.items():
args.extend(["--global-var={}={}".format(variable_name, variable_value)])
args.extend([self.get_full_source_path(source_path), full_output_path])
out, errors = utils.run_command(args, cwd=cwd)
if errors:
raise exceptions.StaticCompilationError(errors)
utils.convert_urls(full_output_path, source_path)
if self.is_sourcemap_enabled:
utils.fix_sourcemap(full_output_path + ".map", source_path, full_output_path)
return self.get_output_path(source_path)
开发者ID:avsd,项目名称:django-static-precompiler,代码行数:27,代码来源:less.py
示例3: compile_file
def compile_file(self, source_path):
full_output_path = self.get_full_output_path(source_path)
# LiveScript bug with source map if the folder isn't already present
if not os.path.exists(os.path.dirname(full_output_path)):
os.makedirs(os.path.dirname(full_output_path))
args = [
self.executable,
"-c",
]
if self.is_sourcemap_enabled:
args.append("-m")
args.append("linked")
args.extend([
"-o", os.path.dirname(full_output_path),
self.get_full_source_path(source_path),
])
return_code, out, errors = utils.run_command(args)
if return_code:
raise exceptions.StaticCompilationError(errors)
if self.is_sourcemap_enabled:
utils.fix_sourcemap(full_output_path + ".map", source_path, full_output_path)
return self.get_output_path(source_path)
开发者ID:jimjase,项目名称:django-static-precompiler,代码行数:25,代码来源:livescript.py
示例4: compile_file
def compile_file(self, source_path):
full_output_path = self.get_full_output_path(source_path)
output_dir = os.path.dirname(full_output_path)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
template_extension = os.path.splitext(source_path)[1].lstrip(".")
args = [
self.executable,
self.get_full_source_path(source_path),
"-e", template_extension,
"-f", full_output_path,
] + self.get_extra_args()
if self.is_sourcemap_enabled:
args += ["--map", full_output_path + ".map"]
return_code, out, errors = utils.run_command(args)
if return_code:
raise exceptions.StaticCompilationError(errors)
if self.is_sourcemap_enabled:
utils.fix_sourcemap(full_output_path + ".map", source_path, full_output_path)
return self.get_output_path(source_path)
开发者ID:jimjase,项目名称:django-static-precompiler,代码行数:28,代码来源:handlebars.py
示例5: compile_file
def compile_file(self, source_path):
args = [
self.executable,
] + self.get_extra_args()
if self.is_sourcemap_enabled:
args.append("-s")
full_output_path = self.get_full_output_path(source_path)
full_output_dirname = os.path.dirname(full_output_path)
if not os.path.exists(full_output_dirname):
os.makedirs(full_output_dirname)
args.extend(["-o", full_output_path])
args.append(self.get_full_source_path(source_path))
return_code, out, errors = utils.run_command(args)
if return_code:
raise exceptions.StaticCompilationError(errors)
if self.is_sourcemap_enabled:
utils.fix_sourcemap(full_output_path + ".map", source_path, full_output_path)
return self.get_output_path(source_path)
开发者ID:jimjase,项目名称:django-static-precompiler,代码行数:25,代码来源:babel.py
示例6: compile_file
def compile_file(self, source_path):
full_source_path = self.get_full_source_path(source_path)
full_output_path = self.get_full_output_path(source_path)
args = [
self.executable,
"--sourcemap={}".format("auto" if self.is_sourcemap_enabled else "none"),
] + self.get_extra_args()
args.extend([
self.get_full_source_path(source_path),
full_output_path,
])
full_output_dirname = os.path.dirname(full_output_path)
if not os.path.exists(full_output_dirname):
os.makedirs(full_output_dirname)
# `cwd` is a directory containing `source_path`.
# Ex: source_path = '1/2/3', full_source_path = '/abc/1/2/3' -> cwd = '/abc'
cwd = os.path.normpath(os.path.join(full_source_path, *([".."] * len(source_path.split("/")))))
out, errors = utils.run_command(args, None, cwd=cwd)
if errors:
if os.path.exists(full_output_path):
os.remove(full_output_path)
raise exceptions.StaticCompilationError(errors)
utils.convert_urls(full_output_path, source_path)
if self.is_sourcemap_enabled:
utils.fix_sourcemap(full_output_path + ".map", source_path, full_output_path)
return self.get_output_path(source_path)
开发者ID:DjangoBD,项目名称:django-static-precompiler,代码行数:33,代码来源:scss.py
示例7: compile_source
def compile_source(self, source):
args = [self.executable] + self.get_extra_args()
out, errors = utils.run_command(args, source)
if errors:
raise exceptions.StaticCompilationError(errors)
return out
开发者ID:avsd,项目名称:django-static-precompiler,代码行数:8,代码来源:babel.py
示例8: compile_file
def compile_file(self, source_path):
command = "{0} {1}".format(LESS_EXECUTABLE, self.get_full_source_path(source_path))
out, errors = run_command(command, None, STATIC_ROOT)
if errors:
raise StaticCompilationError(errors)
return out
开发者ID:hdngr,项目名称:django-static-precompiler,代码行数:8,代码来源:less.py
示例9: compile_source
def compile_source(self, source):
command = "{0} -".format(LESS_EXECUTABLE)
out, errors = run_command(command, source)
if errors:
raise StaticCompilationError(errors)
return out
开发者ID:santtu,项目名称:django-static-precompiler,代码行数:9,代码来源:less.py
示例10: compile_source
def compile_source(self, source):
args = [LESS_EXECUTABLE, "-"]
out, errors = run_command(args, source)
if errors:
raise StaticCompilationError(errors)
return out
开发者ID:vincenzorizza,项目名称:pinseri,代码行数:9,代码来源:less.py
示例11: compile_source
def compile_source(self, source):
args = [
self.executable
]
out, errors = run_command(args, source)
if errors:
raise StaticCompilationError(errors)
return out
开发者ID:and3rson,项目名称:django-static-precompiler,代码行数:9,代码来源:babel.py
示例12: compile_file
def compile_file(self, source_path):
full_source_path = self.get_full_source_path(source_path)
args = [LESS_EXECUTABLE, full_source_path]
# `cwd` is a directory containing `source_path`. Ex: source_path = '1/2/3', full_source_path = '/abc/1/2/3' -> cwd = '/abc'
cwd = os.path.normpath(os.path.join(full_source_path, *([".."] * len(source_path.split("/")))))
out, errors = run_command(args, None, cwd=cwd)
if errors:
raise StaticCompilationError(errors)
return out
开发者ID:vincenzorizza,项目名称:pinseri,代码行数:10,代码来源:less.py
示例13: compile_source
def compile_source(self, source):
command = "{0} -s --scss -C".format(SCSS_EXECUTABLE)
if SCSS_USE_COMPASS:
command += " --compass"
out, errors = run_command(command, source, STATIC_ROOT)
if errors:
raise StaticCompilationError(errors)
return out
开发者ID:hdngr,项目名称:django-static-precompiler,代码行数:11,代码来源:scss.py
示例14: compile_source
def compile_source(self, source):
args = [
self.executable,
"-p",
]
out, errors = utils.run_command(args, input=source)
if errors:
raise exceptions.StaticCompilationError(errors)
return out
开发者ID:avsd,项目名称:django-static-precompiler,代码行数:11,代码来源:stylus.py
示例15: compile_file
def compile_file(self, source_path):
command = "{0} -C {1}".format(SCSS_EXECUTABLE, self.get_full_source_path(source_path))
if SCSS_USE_COMPASS:
command += " --compass"
out, errors = run_command(command, None, STATIC_ROOT)
if errors:
raise StaticCompilationError(errors)
return out
开发者ID:hdngr,项目名称:django-static-precompiler,代码行数:11,代码来源:scss.py
示例16: compile_source
def compile_source(self, source):
args = [
self.executable,
"-c",
"-s",
"-p",
]
return_code, out, errors = utils.run_command(args, source)
if return_code:
raise exceptions.StaticCompilationError(errors)
return out
开发者ID:jimjase,项目名称:django-static-precompiler,代码行数:12,代码来源:livescript.py
示例17: compile_source
def compile_source(self, source):
args = [
COFFEESCRIPT_EXECUTABLE,
"-c",
"-s",
"-p",
]
out, errors = run_command(args, source)
if errors:
raise StaticCompilationError(errors)
return out
开发者ID:Onizuka89,项目名称:django-static-precompiler,代码行数:12,代码来源:coffeescript.py
示例18: compile_source
def compile_source(self, source):
args = [
self.executable
]
if self.modules is not None:
args.extend(["--modules", self.modules])
out, errors = utils.run_command(args, source)
if errors:
raise exceptions.StaticCompilationError(errors)
return out
开发者ID:dotmobo,项目名称:django-static-precompiler,代码行数:13,代码来源:babel.py
示例19: compile_source
def compile_source(self, source):
args = [
self.executable,
"-s",
]
if self.executable.endswith("scss"):
args.append("--sass")
out, errors = utils.run_command(args, source)
if errors:
raise exceptions.StaticCompilationError(errors)
return out
开发者ID:DjangoBD,项目名称:django-static-precompiler,代码行数:13,代码来源:scss.py
示例20: compile_source
def compile_source(self, source):
args = [
self.executable,
"-s",
] + self.get_extra_args()
if self.executable.endswith("sass"):
args.append("--scss")
return_code, out, errors = utils.run_command(args, source)
if return_code:
raise exceptions.StaticCompilationError(errors)
return out
开发者ID:jimjase,项目名称:django-static-precompiler,代码行数:14,代码来源:scss.py
注:本文中的static_precompiler.utils.run_command函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论