Add 'projects/rocprofiler-compute/' from commit 'd2cec001161fc49761bd71a498474a447b1d6975'
git-subtree-dir: projects/rocprofiler-compute git-subtree-mainline:8a4d7262f8git-subtree-split:d2cec00116
This commit is contained in:
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pyinstaller src/rocprofiler-compute.py \
|
||||
--name "rocprofiler-compute" \
|
||||
--add-data "src/perfmon_pub/*:perfmon_pub" \
|
||||
--add-data "src/utils/*:utils" \
|
||||
--add-data "src/soc_params/*.csv:soc_params" \
|
||||
--add-data "src/rocprof_compute_analyze/*:rocprof_compute_analyze" \
|
||||
--hidden-import matplotlib.backends.backend_pdf \
|
||||
${@}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-y*)
|
||||
if [[ "$1" != *=* ]]; then shift; fi
|
||||
y="${1#*=}"
|
||||
;;
|
||||
--workpath*)
|
||||
if [[ "$1" != *=* ]]; then shift; fi
|
||||
workpath="${1#*=}"
|
||||
;;
|
||||
--distpath*)
|
||||
if [[ "$1" != *=* ]]; then shift; fi
|
||||
distpath="${1#*=}"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid argument"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
echo "distpath=$distpath"
|
||||
|
||||
echo "(build.sh) Checking for submodules"
|
||||
# Check to se if submodules are available
|
||||
if [ -d "src/waveparser/" ] && [ -d "src/multevent/" ]
|
||||
then
|
||||
echo "Found submodules"
|
||||
if [ "$(ls -A src/waveparser/)" ] && [ "$(ls -A src/multevent/)" ]; then
|
||||
echo "waveparser and multevents submodules loaded. Packaging..."
|
||||
cp -r src/waveparser/ "$distpath"/waveparser/
|
||||
cp -r src/multevent/ "$distpath"/multevent/
|
||||
else
|
||||
echo "One of your submodules isn't loaded. Skipping submodule packaging"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Couldn't find directory for submodules"
|
||||
fi
|
||||
|
||||
echo "(build.sh) Loading dash_svg"
|
||||
# Take care of dash-svg module that isn't detected by PyInstaller
|
||||
dash_info=$(pip3 show dash_svg)
|
||||
dash_loc=$(sed -n '8p' <<<"$dash_info")
|
||||
cp -r ${dash_loc:10}/dash_svg "$distpath"/rocprofiler-compute/
|
||||
|
||||
echo "(build.sh) Fixing flattened directories"
|
||||
#TODO: Copy orig file structure from over to flattened packaged version
|
||||
rm -rf "$distpath"/rocprofiler-compute/rocprof_compute_analyze/
|
||||
cp -r src/rocprof_compute_analyze/ "$distpath"/rocprofiler-compute/
|
||||
|
||||
rm -rf "$distpath"/rocprofiler-compute/perfmon_pub/
|
||||
cp -r src/perfmon_pub/ "$distpath"/rocprofiler-compute/
|
||||
|
||||
rm -rf "$distpath"/rocprofiler-compute/perfmon/
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
#!/usr/bin/env python3
|
||||
# -------------------------------------------------------------------------------
|
||||
# Support script for license header management.
|
||||
# -------------------------------------------------------------------------------
|
||||
|
||||
import argparse
|
||||
import filecmp
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
begDelim = "######bl$"
|
||||
endDelim = "######el$"
|
||||
maxHeaderLines = 200
|
||||
|
||||
|
||||
def cacheLicenseFile(infile, comment="#"):
|
||||
if not Path(infile).is_file():
|
||||
logging.error("Unable to access license file - >%s" % infile)
|
||||
sys.exit(1)
|
||||
|
||||
license = ""
|
||||
with open(infile, "r") as file_in:
|
||||
for line in file_in:
|
||||
license += comment
|
||||
if line.strip() != "":
|
||||
license += " "
|
||||
license += line
|
||||
return license
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--license", required=True, help="License File")
|
||||
parser.add_argument("--source", required=True, help="Source directory")
|
||||
parser.add_argument("--dryrun", help="enable dryrun mode", action="store_true")
|
||||
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument("--extension", help="file extension to parse")
|
||||
group.add_argument("--files", help="specific file(s) to parse")
|
||||
|
||||
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
srcDir = args.source
|
||||
fileExtension = None
|
||||
specificFiles = None
|
||||
if args.extension:
|
||||
fileExtension = args.extension
|
||||
if args.files:
|
||||
specificFiles = args.files.split(",")
|
||||
|
||||
print("")
|
||||
logging.info("Source directory = %s" % srcDir)
|
||||
if fileExtension:
|
||||
logging.info("File extension = %s" % fileExtension)
|
||||
if specificFiles:
|
||||
logging.info("Specific files = %s" % specificFiles)
|
||||
|
||||
# cache license file
|
||||
license = cacheLicenseFile(args.license)
|
||||
|
||||
# Scan files in provided source directory...
|
||||
for filename in glob.iglob(srcDir + "/**", recursive=True):
|
||||
# skip directories
|
||||
if Path(filename).is_dir():
|
||||
continue
|
||||
|
||||
# File matching options:
|
||||
|
||||
# (1) filter non-matching extensions
|
||||
if fileExtension:
|
||||
if not filename.endswith(fileExtension):
|
||||
continue
|
||||
|
||||
# or, (2) filter for specific filename
|
||||
if specificFiles:
|
||||
found = False
|
||||
for file in specificFiles:
|
||||
fullPath = str(Path(srcDir).joinpath(file))
|
||||
if fullPath == filename:
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
continue
|
||||
|
||||
logging.debug("Examining %s for license..." % filename)
|
||||
|
||||
# Update license header contents if delimiters are found
|
||||
with open(filename, "r") as file_in:
|
||||
baseName = Path(filename).name
|
||||
dirName = str(Path(filename).parent)
|
||||
tmpFile = dirName + "/." + baseName + ".tmp"
|
||||
|
||||
file_out = open(tmpFile, "w")
|
||||
for line in file_in:
|
||||
if re.search(begDelim, line):
|
||||
logging.debug("Found beginning delimiter")
|
||||
file_out.write(line)
|
||||
file_out.write(license)
|
||||
|
||||
foundEnd = False
|
||||
|
||||
for i in range(maxHeaderLines):
|
||||
line = file_in.readline()
|
||||
if re.search(endDelim, line):
|
||||
logging.debug("Found ending delimiter")
|
||||
file_out.write(line)
|
||||
foundEnd = True
|
||||
break
|
||||
if not foundEnd:
|
||||
logging.error("Unable to find end of delimited header")
|
||||
sys.exit(1)
|
||||
|
||||
else:
|
||||
file_out.write(line)
|
||||
|
||||
file_out.close()
|
||||
|
||||
# Check if file changed and update
|
||||
if not filecmp.cmp(filename, tmpFile, shallow=False):
|
||||
logging.info("%s changed" % filename)
|
||||
shutil.copystat(filename, tmpFile)
|
||||
if not args.dryrun:
|
||||
os.rename(tmpFile, filename)
|
||||
else:
|
||||
os.unlink(tmpFile)
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Support utility to check VERSION file against a tagname. Used in
|
||||
# release pipeline.
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--tag", type=str, required=True, help="tagname to check")
|
||||
args = parser.parse_args()
|
||||
|
||||
execPath = str(Path(__file__).parent)
|
||||
with open(execPath + "/../VERSION") as f:
|
||||
repoVer = f.readline().strip()
|
||||
|
||||
repoCheck = "v" + repoVer
|
||||
tag = args.tag
|
||||
|
||||
print("Current repository version = %s" % repoVer)
|
||||
print("--> tagname = %s" % tag)
|
||||
|
||||
|
||||
if repoCheck == tag:
|
||||
print("OK: exact match")
|
||||
exit(0)
|
||||
elif tag.startswith(repoCheck + "-"):
|
||||
print("OK: allowed match with extra delimiter")
|
||||
exit(0)
|
||||
elif tag.startswith("rocm-"):
|
||||
print("OK: allowed match with 'rocm-' prefix")
|
||||
exit(0)
|
||||
else:
|
||||
print("FAIL: no match - double check top-level VERSION file")
|
||||
exit(1)
|
||||
Fai riferimento in un nuovo problema
Block a user