本文整理汇总了Python中webassets.bundle.get_all_bundle_files函数的典型用法代码示例。如果您正苦于以下问题:Python get_all_bundle_files函数的具体用法?Python get_all_bundle_files怎么用?Python get_all_bundle_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_all_bundle_files函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_directory_custom
def test_directory_custom(self):
"""A custom root directory is configured."""
self.env.load_path = [self.tempdir]
self.create_files(['foo', 'module/bar'])
print get_all_bundle_files(Bundle('foo'), self.env)
assert get_all_bundle_files(Bundle('foo'), self.env) == [self.path('foo')]
# We do not recognize references to modules.
assert get_all_bundle_files(Bundle('module/bar'), self.env) == [self.path('module/bar')]
开发者ID:atefzed,项目名称:flask-assets,代码行数:8,代码来源:test_integration.py
示例2: test_custom_load_path
def test_custom_load_path(self):
"""A custom load_path is configured - this will affect how
we deal with source files.
"""
self.env.append_path(self.tempdir, "/custom/")
self.create_files(["foo", "module/bar"])
assert get_all_bundle_files(Bundle("foo"), self.env) == [self.path("foo")]
# We do not recognize references to modules.
assert get_all_bundle_files(Bundle("module/bar"), self.env) == [self.path("module/bar")]
assert Bundle("foo").urls(self.env) == ["/custom/foo"]
assert Bundle("module/bar").urls(self.env) == ["/custom/module/bar"]
开发者ID:kracekumar,项目名称:flask-assets,代码行数:12,代码来源:test_integration.py
示例3: test_duplicate_nested_bundles_removed
def test_duplicate_nested_bundles_removed(self):
nested = self.mkbundle('*.js')
bundle = self.mkbundle(nested, nested)
all_files = get_all_bundle_files(bundle)
all_files.sort()
assert all_files == [self.path('foo.js'), self.path('hubris.js'),
self.path('whimsy.js')]
开发者ID:agustinhenze,项目名称:webassets.debian,代码行数:7,代码来源:test_bundle_various.py
示例4: test_globbed_load_path
def test_globbed_load_path(self):
"""The load path itself can contain globs."""
self.env.append_path(self.path('*'))
self.create_files({'a/foo': 'a', 'b/foo': 'b', 'dir/bar': 'dir'})
# With a non-globbed reference
bundle = self.mkbundle('foo', output='out')
assert set(get_all_bundle_files(bundle)) == set([
self.path('a/foo'), self.path('b/foo')
])
# With a globbed reference
bundle = self.mkbundle('???', output='out')
assert set(get_all_bundle_files(bundle)) == set([
self.path('a/foo'), self.path('b/foo'), self.path('dir/bar')
])
开发者ID:Topidesta,项目名称:webassets,代码行数:16,代码来源:test_bundle_various.py
示例5: test_custom_load_path
def test_custom_load_path(self):
"""A custom load_path is configured - this will affect how
we deal with source files.
"""
self.env.append_path(self.tempdir, '/custom/')
self.create_files(['foo', 'module/bar'])
assert get_all_bundle_files(Bundle('foo'), self.env) == [self.path('foo')]
# We do not recognize references to modules.
assert get_all_bundle_files(Bundle('module/bar'), self.env) == [self.path('module/bar')]
assert Bundle('foo').urls(self.env) == ['/custom/foo']
assert Bundle('module/bar').urls(self.env) == ['/custom/module/bar']
# [Regression] With a load path configured, generating output
# urls still works, and it still uses the flask system.
self.env.debug = False
self.env.url_expire = False
assert Bundle('foo', output='out').urls(self.env) == ['/app_static/out']
开发者ID:Nanodesu,项目名称:flask-assets,代码行数:18,代码来源:test_integration.py
示例6: test_directory_auto
def test_directory_auto(self):
"""Test how we handle file references if no root 'directory' is
configured manually.
"""
assert not 'directory' in self.env.config
root = self.app.root_path
assert get_all_bundle_files(Bundle('foo'), self.env) == [root + '/static/foo']
# Modules prefixes in paths are handled specifically.
assert get_all_bundle_files(Bundle('module/bar'), self.env) == [root + '/test_module/static/bar']
# Prefixes that aren't valid module names are just considered
# subfolders of the main app.
assert get_all_bundle_files(Bundle('nomodule/bar'), self.env) == [root + '/static/nomodule/bar']
# In case the name of a app-level subfolder conflicts with a
# module name, you can always use this hack:
assert get_all_bundle_files(Bundle('./module/bar'), self.env) == [root + '/static/module/bar']
# Custom static folder
self.app.static_folder = '/'
assert get_all_bundle_files(Bundle('foo'), self.env) == ['/foo']
开发者ID:aisipos,项目名称:flask-assets,代码行数:19,代码来源:test_integration.py
示例7: test_directory_auto
def test_directory_auto(self):
"""Test how we resolve file references through the Flask static
system by default (if no custom 'env.directory' etc. values
have been configured manually).
"""
assert not "directory" in self.env.config
root = self.app.root_path
assert get_all_bundle_files(Bundle("foo"), self.env) == [root + "/static/foo"]
# Modules prefixes in paths are handled specifically.
assert get_all_bundle_files(Bundle("module/bar"), self.env) == [root + "/test_module/static/bar"]
# Prefixes that aren't valid module names are just considered
# subfolders of the main app.
assert get_all_bundle_files(Bundle("nomodule/bar"), self.env) == [root + "/static/nomodule/bar"]
# In case the name of a app-level subfolder conflicts with a
# module name, you can always use this hack:
assert get_all_bundle_files(Bundle("./module/bar"), self.env) == [root + "/static/module/bar"]
# Custom static folder
self.app.static_folder = "/"
assert get_all_bundle_files(Bundle("foo"), self.env) == ["/foo"]
开发者ID:kracekumar,项目名称:flask-assets,代码行数:20,代码来源:test_integration.py
示例8: test
def test(self):
"""Make sure the "url" and "directory" config values are
read from the Flask app.
"""
with self.app.test_request_context():
assert not "url" in self.env.config
assert Bundle("foo").urls(self.env) == ["/initapp_static/foo"]
assert not "directory" in self.env.config
root = self.app.root_path
assert get_all_bundle_files(Bundle("foo"), self.env) == [root + "/static/foo"]
开发者ID:kracekumar,项目名称:flask-assets,代码行数:11,代码来源:test_integration.py
示例9: test
def test(self):
"""Make sure the "url" and "directory" config values are
read from the Flask app.
"""
with self.app.test_request_context():
assert not 'url' in self.env.config
assert Bundle('foo', env=self.env).urls() == ['/initapp_static/foo']
assert not 'directory' in self.env.config
root = self.app.root_path
assert get_all_bundle_files(Bundle('foo'), self.env) == [root + '/static/foo']
开发者ID:Mondego,项目名称:pyreco,代码行数:11,代码来源:allPythonContent.py
示例10: find_recent_most_timestamp
def find_recent_most_timestamp(cls, bundle, env):
# Recurse through the bundle hierarchy. Check the timestamp of all
# the bundle source files, as well as any additional
# dependencies that we are supposed to watch.
most_recent = None
for filename in get_all_bundle_files(bundle, env):
if is_url(filename):
continue
timestamp = cls.get_timestamp(filename)
if most_recent is None or timestamp > most_recent:
most_recent = timestamp
return most_recent
开发者ID:benthor,项目名称:webassets,代码行数:12,代码来源:version.py
示例11: test_globbing
def test_globbing(self):
"""When used with globbing."""
self.env.append_path(self.path('a'))
self.env.append_path(self.path('b'))
self.create_files({
'a/foo': 'a', 'b/foo': 'b', 'b/bar': '42'})
# Returns all files, even duplicate relative filenames in
# multiple load paths (foo in this case).
bundle = self.mkbundle('*', output='out')
assert set(get_all_bundle_files(bundle)) == set([
self.path('a/foo'), self.path('b/foo'), self.path('b/bar')
])
开发者ID:Topidesta,项目名称:webassets,代码行数:13,代码来源:test_bundle_various.py
示例12: check_for_changes
def check_for_changes():
changed_bundles = []
for bundle in self.environment:
for filename in get_all_bundle_files(bundle):
stat = os.stat(filename)
mtime = stat.st_mtime
if _win:
mtime -= stat.st_ctime
if _mtimes.get(filename, mtime) != mtime:
changed_bundles.append(bundle)
_mtimes[filename] = mtime
break
_mtimes[filename] = mtime
return changed_bundles
开发者ID:chexov,项目名称:webassets,代码行数:15,代码来源:script.py
示例13: check_for_changes
def check_for_changes():
# Do not update original mtimes dict right away, so that we detect
# all bundle changes if a file is in multiple bundles.
_new_mtimes = _mtimes.copy()
changed_bundles = []
for bundle in self.environment:
for filename in get_all_bundle_files(bundle):
stat = os.stat(filename)
mtime = stat.st_mtime
if _win:
mtime -= stat.st_ctime
if _mtimes.get(filename, mtime) != mtime:
changed_bundles.append(bundle)
_new_mtimes[filename] = mtime
break
_new_mtimes[filename] = mtime
_mtimes.update(_new_mtimes)
return changed_bundles
开发者ID:bryanchow,项目名称:webassets,代码行数:21,代码来源:script.py
示例14: test_directory_custom
def test_directory_custom(self):
"""A custom root directory is configured."""
self.env.directory = '/tmp'
assert get_all_bundle_files(Bundle('foo'), self.env) == ['/tmp/foo']
# We do not recognize references to modules.
assert get_all_bundle_files(Bundle('module/bar'), self.env) == ['/tmp/module/bar']
开发者ID:aisipos,项目名称:flask-assets,代码行数:6,代码来源:test_integration.py
示例15: test_do_not_glob_directories
def test_do_not_glob_directories(self):
"""[Regression] Glob should be smart enough not to pick
up directories."""
self.create_directories('subdir')
assert not [s for s in get_all_bundle_files(self.mkbundle('*')) if 'subdir' in s]
开发者ID:benthor,项目名称:webassets,代码行数:5,代码来源:test_bundle_various.py
示例16: test_glob_exclude_output
def test_glob_exclude_output(self):
"""Never include the output file in the globbinb result.
"""
self.create_files(['out.js'])
assert not list(filter(lambda s: 'out.js' in s,
get_all_bundle_files(self.mkbundle('*', output='out.js'))))
开发者ID:Topidesta,项目名称:webassets,代码行数:6,代码来源:test_bundle_various.py
示例17: test_do_not_glob_directories
def test_do_not_glob_directories(self):
"""[Regression] Glob should be smart enough not to pick
up directories."""
self.create_directories('subdir')
assert not list(filter(lambda s: 'subdir' in s,
get_all_bundle_files(self.mkbundle('*'))))
开发者ID:Topidesta,项目名称:webassets,代码行数:6,代码来源:test_bundle_various.py
示例18: test_glob_exclude_output
def test_glob_exclude_output(self):
"""Never include the output file in the globbinb result.
"""
self.create_files(['out.js'])
assert not [s for s in get_all_bundle_files(self.mkbundle('*', output='out.js')) if 'out.js' in s]
开发者ID:benthor,项目名称:webassets,代码行数:5,代码来源:test_bundle_various.py
示例19: yield_files_to_watch
def yield_files_to_watch(self):
for bundle in self.environment:
for filename in get_all_bundle_files(bundle):
yield filename, set([bundle])
开发者ID:grillermo,项目名称:webassets,代码行数:4,代码来源:script.py
注:本文中的webassets.bundle.get_all_bundle_files函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论