mirror of
https://github.com/facebook/zstd.git
synced 2025-08-08 17:22:10 +03:00
[contrib][freestanding] Remove tracing support
Remove tracing support from `freestanding.py` to keep things simple.
This commit is contained in:
@@ -27,6 +27,7 @@ SKIPPED_FILES = [
|
|||||||
"common/pool.h",
|
"common/pool.h",
|
||||||
"common/threading.c",
|
"common/threading.c",
|
||||||
"common/threading.h",
|
"common/threading.h",
|
||||||
|
"common/zstd_trace.c",
|
||||||
"compress/zstdmt_compress.h",
|
"compress/zstdmt_compress.h",
|
||||||
"compress/zstdmt_compress.c",
|
"compress/zstdmt_compress.c",
|
||||||
]
|
]
|
||||||
@@ -471,7 +472,7 @@ class Freestanding(object):
|
|||||||
dst_path = os.path.join(self._dst_lib, lib_path)
|
dst_path = os.path.join(self._dst_lib, lib_path)
|
||||||
self._log(f"\tCopying: {src_path} -> {dst_path}")
|
self._log(f"\tCopying: {src_path} -> {dst_path}")
|
||||||
shutil.copyfile(src_path, dst_path)
|
shutil.copyfile(src_path, dst_path)
|
||||||
|
|
||||||
def _copy_source_lib(self):
|
def _copy_source_lib(self):
|
||||||
self._log("Copying source library into output library")
|
self._log("Copying source library into output library")
|
||||||
|
|
||||||
@@ -481,14 +482,14 @@ class Freestanding(object):
|
|||||||
for subdir in INCLUDED_SUBDIRS:
|
for subdir in INCLUDED_SUBDIRS:
|
||||||
src_dir = os.path.join(self._src_lib, subdir)
|
src_dir = os.path.join(self._src_lib, subdir)
|
||||||
dst_dir = os.path.join(self._dst_lib, subdir)
|
dst_dir = os.path.join(self._dst_lib, subdir)
|
||||||
|
|
||||||
assert os.path.exists(src_dir)
|
assert os.path.exists(src_dir)
|
||||||
os.makedirs(dst_dir, exist_ok=True)
|
os.makedirs(dst_dir, exist_ok=True)
|
||||||
|
|
||||||
for filename in os.listdir(src_dir):
|
for filename in os.listdir(src_dir):
|
||||||
lib_path = os.path.join(subdir, filename)
|
lib_path = os.path.join(subdir, filename)
|
||||||
self._copy_file(lib_path)
|
self._copy_file(lib_path)
|
||||||
|
|
||||||
def _copy_zstd_deps(self):
|
def _copy_zstd_deps(self):
|
||||||
dst_zstd_deps = os.path.join(self._dst_lib, "common", "zstd_deps.h")
|
dst_zstd_deps = os.path.join(self._dst_lib, "common", "zstd_deps.h")
|
||||||
self._log(f"Copying zstd_deps: {self._zstd_deps} -> {dst_zstd_deps}")
|
self._log(f"Copying zstd_deps: {self._zstd_deps} -> {dst_zstd_deps}")
|
||||||
@@ -508,7 +509,7 @@ class Freestanding(object):
|
|||||||
assert not (undef and value is not None)
|
assert not (undef and value is not None)
|
||||||
for filepath in self._dst_lib_file_paths():
|
for filepath in self._dst_lib_file_paths():
|
||||||
file = FileLines(filepath)
|
file = FileLines(filepath)
|
||||||
|
|
||||||
def _hardwire_defines(self):
|
def _hardwire_defines(self):
|
||||||
self._log("Hardwiring macros")
|
self._log("Hardwiring macros")
|
||||||
partial_preprocessor = PartialPreprocessor(self._defs, self._replaces, self._undefs)
|
partial_preprocessor = PartialPreprocessor(self._defs, self._replaces, self._undefs)
|
||||||
@@ -536,7 +537,7 @@ class Freestanding(object):
|
|||||||
skipped.append(line)
|
skipped.append(line)
|
||||||
if end_re.search(line) is not None:
|
if end_re.search(line) is not None:
|
||||||
assert begin_re.search(line) is None
|
assert begin_re.search(line) is None
|
||||||
self._log(f"\t\tRemoving excluded section: {exclude}")
|
self._log(f"\t\tRemoving excluded section: {exclude}")
|
||||||
for s in skipped:
|
for s in skipped:
|
||||||
self._log(f"\t\t\t- {s}")
|
self._log(f"\t\t\t- {s}")
|
||||||
emit = True
|
emit = True
|
||||||
@@ -559,12 +560,12 @@ class Freestanding(object):
|
|||||||
e = match.end('include')
|
e = match.end('include')
|
||||||
file.lines[i] = line[:s] + rewritten + line[e:]
|
file.lines[i] = line[:s] + rewritten + line[e:]
|
||||||
file.write()
|
file.write()
|
||||||
|
|
||||||
def _rewrite_includes(self):
|
def _rewrite_includes(self):
|
||||||
self._log("Rewriting includes")
|
self._log("Rewriting includes")
|
||||||
for original, rewritten in self._rewritten_includes:
|
for original, rewritten in self._rewritten_includes:
|
||||||
self._rewrite_include(original, rewritten)
|
self._rewrite_include(original, rewritten)
|
||||||
|
|
||||||
def _replace_xxh64_prefix(self):
|
def _replace_xxh64_prefix(self):
|
||||||
if self._xxh64_prefix is None:
|
if self._xxh64_prefix is None:
|
||||||
return
|
return
|
||||||
@@ -656,6 +657,10 @@ def main(name, args):
|
|||||||
if name in args.undefs:
|
if name in args.undefs:
|
||||||
raise RuntimeError(f"{name} is both defined and undefined!")
|
raise RuntimeError(f"{name} is both defined and undefined!")
|
||||||
|
|
||||||
|
# Always set tracing to 0
|
||||||
|
if "ZSTD_TRACE" not in (arg[0] for arg in args.defs):
|
||||||
|
args.defs.append(("ZSTD_TRACE", "0"))
|
||||||
|
|
||||||
args.replaces = parse_pair(args.replaces)
|
args.replaces = parse_pair(args.replaces)
|
||||||
for name, _ in args.replaces:
|
for name, _ in args.replaces:
|
||||||
if name in args.undefs or name in args.defs:
|
if name in args.undefs or name in args.defs:
|
||||||
|
Reference in New Issue
Block a user