Renamed module tracer → trace
This is consistent with the other module names.
This commit is contained in:
parent
e8f41f2735
commit
632d01334c
@ -5,7 +5,7 @@ import logging
|
|||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from blender_asset_tracer import tracer
|
from blender_asset_tracer import trace
|
||||||
from . import common
|
from . import common
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -37,7 +37,7 @@ def report_text(bpath):
|
|||||||
last_reported_bfile = None
|
last_reported_bfile = None
|
||||||
shorten = functools.partial(common.shorten, pathlib.Path.cwd())
|
shorten = functools.partial(common.shorten, pathlib.Path.cwd())
|
||||||
|
|
||||||
for usage in tracer.deps(bpath):
|
for usage in trace.deps(bpath):
|
||||||
filepath = usage.block.bfile.filepath.absolute()
|
filepath = usage.block.bfile.filepath.absolute()
|
||||||
if filepath != last_reported_bfile:
|
if filepath != last_reported_bfile:
|
||||||
print(shorten(filepath))
|
print(shorten(filepath))
|
||||||
@ -68,7 +68,7 @@ def report_json(bpath):
|
|||||||
# Mapping from blend file to its dependencies.
|
# Mapping from blend file to its dependencies.
|
||||||
report = collections.defaultdict(set)
|
report = collections.defaultdict(set)
|
||||||
|
|
||||||
for usage in tracer.deps(bpath):
|
for usage in trace.deps(bpath):
|
||||||
filepath = usage.block.bfile.filepath.absolute()
|
filepath = usage.block.bfile.filepath.absolute()
|
||||||
for assetpath in usage.files():
|
for assetpath in usage.files():
|
||||||
assetpath = assetpath.resolve()
|
assetpath = assetpath.resolve()
|
||||||
|
|||||||
@ -5,9 +5,9 @@ import logging
|
|||||||
import pathlib
|
import pathlib
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from blender_asset_tracer import tracer, bpathlib, blendfile
|
from blender_asset_tracer import trace, bpathlib, blendfile
|
||||||
from blender_asset_tracer.cli import common
|
from blender_asset_tracer.cli import common
|
||||||
from blender_asset_tracer.tracer import result
|
from blender_asset_tracer.trace import result
|
||||||
from . import queued_copy
|
from . import queued_copy
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -78,7 +78,7 @@ class Packer:
|
|||||||
act.new_path = bfile_pp
|
act.new_path = bfile_pp
|
||||||
|
|
||||||
new_location_paths = set()
|
new_location_paths = set()
|
||||||
for usage in tracer.deps(self.blendfile):
|
for usage in trace.deps(self.blendfile):
|
||||||
# Needing rewriting is not a per-asset thing, but a per-asset-per-
|
# Needing rewriting is not a per-asset thing, but a per-asset-per-
|
||||||
# blendfile thing, since different blendfiles can refer to it in
|
# blendfile thing, since different blendfiles can refer to it in
|
||||||
# different ways (for example with relative and absolute paths).
|
# different ways (for example with relative and absolute paths).
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import logging
|
|||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from blender_asset_tracer import tracer, blendfile
|
from blender_asset_tracer import trace, blendfile
|
||||||
from blender_asset_tracer.blendfile import dna
|
from blender_asset_tracer.blendfile import dna
|
||||||
from abstract_test import AbstractBlendFileTest
|
from abstract_test import AbstractBlendFileTest
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ class AssetHoldingBlocksTest(AbstractTracerTest):
|
|||||||
blocks_seen = 0
|
blocks_seen = 0
|
||||||
seen_scene = seen_ob = False
|
seen_scene = seen_ob = False
|
||||||
|
|
||||||
for block in tracer.asset_holding_blocks(self.bf.blocks):
|
for block in trace.asset_holding_blocks(self.bf.blocks):
|
||||||
assert isinstance(block, blendfile.BlendFileBlock)
|
assert isinstance(block, blendfile.BlendFileBlock)
|
||||||
blocks_seen += 1
|
blocks_seen += 1
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class DepsTest(AbstractTracerTest):
|
|||||||
return field.name.name_full.decode()
|
return field.name.name_full.decode()
|
||||||
|
|
||||||
def assert_deps(self, blend_fname, expects: dict):
|
def assert_deps(self, blend_fname, expects: dict):
|
||||||
for dep in tracer.deps(self.blendfiles / blend_fname):
|
for dep in trace.deps(self.blendfiles / blend_fname):
|
||||||
actual_type = dep.block.dna_type.dna_type_id.decode()
|
actual_type = dep.block.dna_type.dna_type_id.decode()
|
||||||
actual_full_field = self.field_name(dep.path_full_field)
|
actual_full_field = self.field_name(dep.path_full_field)
|
||||||
actual_dirname = self.field_name(dep.path_dir_field)
|
actual_dirname = self.field_name(dep.path_dir_field)
|
||||||
@ -138,7 +138,7 @@ class DepsTest(AbstractTracerTest):
|
|||||||
# Test the filename expansion.
|
# Test the filename expansion.
|
||||||
expected = [self.blendfiles / ('imgseq/%06d.png' % num)
|
expected = [self.blendfiles / ('imgseq/%06d.png' % num)
|
||||||
for num in range(210, 215)]
|
for num in range(210, 215)]
|
||||||
for dep in tracer.deps(self.blendfiles / 'image_sequencer.blend'):
|
for dep in trace.deps(self.blendfiles / 'image_sequencer.blend'):
|
||||||
if dep.block_name != b'SQ000210.png':
|
if dep.block_name != b'SQ000210.png':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ class DepsTest(AbstractTracerTest):
|
|||||||
})
|
})
|
||||||
|
|
||||||
def test_usage_abspath(self):
|
def test_usage_abspath(self):
|
||||||
deps = [dep for dep in tracer.deps(self.blendfiles / 'doubly_linked.blend')
|
deps = [dep for dep in trace.deps(self.blendfiles / 'doubly_linked.blend')
|
||||||
if dep.asset_path == b'//material_textures.blend']
|
if dep.asset_path == b'//material_textures.blend']
|
||||||
usage = deps[0]
|
usage = deps[0]
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ class DepsTest(AbstractTracerTest):
|
|||||||
try:
|
try:
|
||||||
sys.setrecursionlimit(80)
|
sys.setrecursionlimit(80)
|
||||||
# This should finish without hitting the recursion limit.
|
# This should finish without hitting the recursion limit.
|
||||||
for _ in tracer.deps(infinite_bfile):
|
for _ in trace.deps(infinite_bfile):
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
sys.setrecursionlimit(reclim)
|
sys.setrecursionlimit(reclim)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from blender_asset_tracer import blendfile
|
from blender_asset_tracer import blendfile
|
||||||
from blender_asset_tracer.tracer import file2blocks
|
from blender_asset_tracer.trace import file2blocks
|
||||||
|
|
||||||
from test_tracer import AbstractTracerTest
|
from test_tracer import AbstractTracerTest
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
from abstract_test import AbstractBlendFileTest
|
from abstract_test import AbstractBlendFileTest
|
||||||
|
|
||||||
from blender_asset_tracer.tracer import file_sequence
|
from blender_asset_tracer.trace import file_sequence
|
||||||
|
|
||||||
|
|
||||||
class ExpandFileSequenceTest(AbstractBlendFileTest):
|
class ExpandFileSequenceTest(AbstractBlendFileTest):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user