scripts: Renamed summary.py -> csv.py
This seems like a more fitting name now that this script has evolved
into more of a general purpose high-level CSV tool.
Unfortunately this does conflict with the standard csv module in Python,
breaking every script that imports csv (which is most of them).
Fortunately, Python is flexible enough to let us remove the current
directory before imports with a bit of an ugly hack:
# prevent local imports
__import__('sys').path.pop(0)
These scripts are intended to be standalone anyways, so this is probably
a good pattern to adopt.
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
# Amortize benchmark measurements
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import itertools as it
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
# Compute averages/etc of benchmark measurements
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import itertools as it
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import errno
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import glob
|
||||
import itertools
|
||||
import os
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import difflib
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import itertools as it
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import io
|
||||
import os
|
||||
import struct
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Script to summarize the outputs of other scripts. Operates on CSV files.
|
||||
# Script to manipulate CSV files.
|
||||
#
|
||||
# Example:
|
||||
# ./scripts/code.py lfs.o lfs_util.o -q -o lfs.code.csv
|
||||
# ./scripts/data.py lfs.o lfs_util.o -q -o lfs.data.csv
|
||||
# ./scripts/summary.py lfs.code.csv lfs.data.csv -q -o lfs.csv
|
||||
# ./scripts/summary.py -Y lfs.csv -f code=code_size,data=data_size
|
||||
# ./scripts/csv.py lfs.code.csv lfs.data.csv -q -o lfs.csv
|
||||
# ./scripts/csv.py -Y lfs.csv -f code=code_size,data=data_size
|
||||
#
|
||||
# Copyright (c) 2022, The littlefs authors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import functools as ft
|
||||
@@ -739,7 +742,7 @@ if __name__ == "__main__":
|
||||
import argparse
|
||||
import sys
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Summarize measurements in CSV files.",
|
||||
description="Script to manipulate CSV files.",
|
||||
allow_abbrev=False)
|
||||
parser.add_argument(
|
||||
'csv_paths',
|
||||
@@ -12,6 +12,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import difflib
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import os
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import bisect
|
||||
import collections as co
|
||||
import functools as ft
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import bisect
|
||||
import collections as co
|
||||
import itertools as it
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import os
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
|
||||
ERRS = [
|
||||
('OK', 0, "No error" ),
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import bisect
|
||||
import collections as co
|
||||
import functools as ft
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import bisect
|
||||
import collections as co
|
||||
import itertools as it
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import bisect
|
||||
import collections as co
|
||||
import itertools as it
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import io
|
||||
import os
|
||||
import struct
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import io
|
||||
import os
|
||||
import struct
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import bisect
|
||||
import collections as co
|
||||
import csv
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import bisect
|
||||
import collections as co
|
||||
import csv
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import bisect
|
||||
import codecs
|
||||
import collections as co
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import codecs
|
||||
import collections as co
|
||||
import csv
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import itertools as it
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import difflib
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import io
|
||||
import os
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import os
|
||||
import io
|
||||
import time
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import csv
|
||||
import errno
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import functools as ft
|
||||
import io
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# prevent local imports
|
||||
__import__('sys').path.pop(0)
|
||||
|
||||
import collections as co
|
||||
import errno
|
||||
import fcntl
|
||||
|
||||
Reference in New Issue
Block a user