From 32f882098d00dbb788e4f54041031771157d37f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Ka=C5=BAmierczyk?= Date: Sat, 9 Nov 2024 16:18:18 +0100 Subject: [PATCH] Revert "Ref #8 Changing directory structure" This reverts commit f3f2d980c7fa0f5515f77830f9f789838272a3ee. --- ...tion.py => abstract_snapshot_collection.py | 0 ...llection.py => code_snapshot_collection.py | 0 .../constants.py => constants.py | 2 +- .../javacore-analyser/data => data}/expand.js | 0 .../data => data}/jquery/chart.js | 0 .../chartjs-adapter-date-fns.bundle.min.js | 0 .../data => data}/jquery/jq.css | 0 .../data => data}/jquery/jquery.mark.min.js | 0 .../data => data}/jquery/jquery.min.js | 0 .../jquery/jquery.tablesorter.min.js | 0 .../jquery/jquery.tablesorter.widgets.min.js | 0 .../data => data}/jquery/search.js | 0 .../data => data}/jquery/sorting.js | 0 .../data => data}/jquery/theme.blue.css | 0 .../jquery/theme.default.min.css | 0 .../data => data}/jquery/wait2scripts.js | 0 .../javacore-analyser/data => data}/style.css | 0 .../data => data}/xml/index.xml | 0 .../data => data}/xml/javacores/javacore.xml | 0 .../data => data}/xml/javacores/javacore.xsl | 0 .../data => data}/xml/report.xsl | 0 .../data => data}/xml/threads/thread.xml | 0 .../data => data}/xml/threads/thread.xsl | 0 .../java_thread.py => java_thread.py | 0 .../javacore.py => javacore.py | 0 ...nalyser_web.py => javacore_analyser_web.py | 0 ...vacore_analyzer.py => javacore_analyzer.py | 0 .../javacore_set.py => javacore_set.py | 24 +++++++------------ .../logging_utils.py => logging_utils.py | 0 ...ot_collection.py => snapshot_collection.py | 0 ...on.py => snapshot_collection_collection.py | 0 src/javacore-analyser/__init__.py | 0 .../stack_trace.py => stack_trace.py | 0 ...trace_element.py => stack_trace_element.py | 0 ...stack_trace_kind.py => stack_trace_kind.py | 0 .../templates => templates}/index.html | 0 test/__init__.py | 4 ++++ test/test_code_snapshot_collection.py | 2 +- test/test_javacore_analyzer.py | 2 +- .../thread_snapshot.py => thread_snapshot.py | 0 src/javacore-analyser/tips.py => tips.py | 0 .../verbose_gc.py => verbose_gc.py | 0 42 files changed, 16 insertions(+), 18 deletions(-) rename src/javacore-analyser/abstract_snapshot_collection.py => abstract_snapshot_collection.py (100%) rename src/javacore-analyser/code_snapshot_collection.py => code_snapshot_collection.py (100%) rename src/javacore-analyser/constants.py => constants.py (95%) rename {src/javacore-analyser/data => data}/expand.js (100%) rename {src/javacore-analyser/data => data}/jquery/chart.js (100%) rename {src/javacore-analyser/data => data}/jquery/chartjs-adapter-date-fns.bundle.min.js (100%) rename {src/javacore-analyser/data => data}/jquery/jq.css (100%) rename {src/javacore-analyser/data => data}/jquery/jquery.mark.min.js (100%) rename {src/javacore-analyser/data => data}/jquery/jquery.min.js (100%) rename {src/javacore-analyser/data => data}/jquery/jquery.tablesorter.min.js (100%) rename {src/javacore-analyser/data => data}/jquery/jquery.tablesorter.widgets.min.js (100%) rename {src/javacore-analyser/data => data}/jquery/search.js (100%) rename {src/javacore-analyser/data => data}/jquery/sorting.js (100%) rename {src/javacore-analyser/data => data}/jquery/theme.blue.css (100%) rename {src/javacore-analyser/data => data}/jquery/theme.default.min.css (100%) rename {src/javacore-analyser/data => data}/jquery/wait2scripts.js (100%) rename {src/javacore-analyser/data => data}/style.css (100%) rename {src/javacore-analyser/data => data}/xml/index.xml (100%) rename {src/javacore-analyser/data => data}/xml/javacores/javacore.xml (100%) rename {src/javacore-analyser/data => data}/xml/javacores/javacore.xsl (100%) rename {src/javacore-analyser/data => data}/xml/report.xsl (100%) rename {src/javacore-analyser/data => data}/xml/threads/thread.xml (100%) rename {src/javacore-analyser/data => data}/xml/threads/thread.xsl (100%) rename src/javacore-analyser/java_thread.py => java_thread.py (100%) rename src/javacore-analyser/javacore.py => javacore.py (100%) rename src/javacore-analyser/javacore_analyser_web.py => javacore_analyser_web.py (100%) rename src/javacore-analyser/javacore_analyzer.py => javacore_analyzer.py (100%) rename src/javacore-analyser/javacore_set.py => javacore_set.py (96%) rename src/javacore-analyser/logging_utils.py => logging_utils.py (100%) rename src/javacore-analyser/snapshot_collection.py => snapshot_collection.py (100%) rename src/javacore-analyser/snapshot_collection_collection.py => snapshot_collection_collection.py (100%) delete mode 100644 src/javacore-analyser/__init__.py rename src/javacore-analyser/stack_trace.py => stack_trace.py (100%) rename src/javacore-analyser/stack_trace_element.py => stack_trace_element.py (100%) rename src/javacore-analyser/stack_trace_kind.py => stack_trace_kind.py (100%) rename {src/javacore-analyser/templates => templates}/index.html (100%) create mode 100644 test/__init__.py rename src/javacore-analyser/thread_snapshot.py => thread_snapshot.py (100%) rename src/javacore-analyser/tips.py => tips.py (100%) rename src/javacore-analyser/verbose_gc.py => verbose_gc.py (100%) diff --git a/src/javacore-analyser/abstract_snapshot_collection.py b/abstract_snapshot_collection.py similarity index 100% rename from src/javacore-analyser/abstract_snapshot_collection.py rename to abstract_snapshot_collection.py diff --git a/src/javacore-analyser/code_snapshot_collection.py b/code_snapshot_collection.py similarity index 100% rename from src/javacore-analyser/code_snapshot_collection.py rename to code_snapshot_collection.py diff --git a/src/javacore-analyser/constants.py b/constants.py similarity index 95% rename from src/javacore-analyser/constants.py rename to constants.py index 1d9a6bd..7c78c30 100644 --- a/src/javacore-analyser/constants.py +++ b/constants.py @@ -35,5 +35,5 @@ DATE_FORMAT = "%Y-%m-%d %H:%M:%S" # Web application constants -DEFAULT_REPORTS_DIR = "../../reports" +DEFAULT_REPORTS_DIR = "reports" DEFAULT_PORT = 5000 diff --git a/src/javacore-analyser/data/expand.js b/data/expand.js similarity index 100% rename from src/javacore-analyser/data/expand.js rename to data/expand.js diff --git a/src/javacore-analyser/data/jquery/chart.js b/data/jquery/chart.js similarity index 100% rename from src/javacore-analyser/data/jquery/chart.js rename to data/jquery/chart.js diff --git a/src/javacore-analyser/data/jquery/chartjs-adapter-date-fns.bundle.min.js b/data/jquery/chartjs-adapter-date-fns.bundle.min.js similarity index 100% rename from src/javacore-analyser/data/jquery/chartjs-adapter-date-fns.bundle.min.js rename to data/jquery/chartjs-adapter-date-fns.bundle.min.js diff --git a/src/javacore-analyser/data/jquery/jq.css b/data/jquery/jq.css similarity index 100% rename from src/javacore-analyser/data/jquery/jq.css rename to data/jquery/jq.css diff --git a/src/javacore-analyser/data/jquery/jquery.mark.min.js b/data/jquery/jquery.mark.min.js similarity index 100% rename from src/javacore-analyser/data/jquery/jquery.mark.min.js rename to data/jquery/jquery.mark.min.js diff --git a/src/javacore-analyser/data/jquery/jquery.min.js b/data/jquery/jquery.min.js similarity index 100% rename from src/javacore-analyser/data/jquery/jquery.min.js rename to data/jquery/jquery.min.js diff --git a/src/javacore-analyser/data/jquery/jquery.tablesorter.min.js b/data/jquery/jquery.tablesorter.min.js similarity index 100% rename from src/javacore-analyser/data/jquery/jquery.tablesorter.min.js rename to data/jquery/jquery.tablesorter.min.js diff --git a/src/javacore-analyser/data/jquery/jquery.tablesorter.widgets.min.js b/data/jquery/jquery.tablesorter.widgets.min.js similarity index 100% rename from src/javacore-analyser/data/jquery/jquery.tablesorter.widgets.min.js rename to data/jquery/jquery.tablesorter.widgets.min.js diff --git a/src/javacore-analyser/data/jquery/search.js b/data/jquery/search.js similarity index 100% rename from src/javacore-analyser/data/jquery/search.js rename to data/jquery/search.js diff --git a/src/javacore-analyser/data/jquery/sorting.js b/data/jquery/sorting.js similarity index 100% rename from src/javacore-analyser/data/jquery/sorting.js rename to data/jquery/sorting.js diff --git a/src/javacore-analyser/data/jquery/theme.blue.css b/data/jquery/theme.blue.css similarity index 100% rename from src/javacore-analyser/data/jquery/theme.blue.css rename to data/jquery/theme.blue.css diff --git a/src/javacore-analyser/data/jquery/theme.default.min.css b/data/jquery/theme.default.min.css similarity index 100% rename from src/javacore-analyser/data/jquery/theme.default.min.css rename to data/jquery/theme.default.min.css diff --git a/src/javacore-analyser/data/jquery/wait2scripts.js b/data/jquery/wait2scripts.js similarity index 100% rename from src/javacore-analyser/data/jquery/wait2scripts.js rename to data/jquery/wait2scripts.js diff --git a/src/javacore-analyser/data/style.css b/data/style.css similarity index 100% rename from src/javacore-analyser/data/style.css rename to data/style.css diff --git a/src/javacore-analyser/data/xml/index.xml b/data/xml/index.xml similarity index 100% rename from src/javacore-analyser/data/xml/index.xml rename to data/xml/index.xml diff --git a/src/javacore-analyser/data/xml/javacores/javacore.xml b/data/xml/javacores/javacore.xml similarity index 100% rename from src/javacore-analyser/data/xml/javacores/javacore.xml rename to data/xml/javacores/javacore.xml diff --git a/src/javacore-analyser/data/xml/javacores/javacore.xsl b/data/xml/javacores/javacore.xsl similarity index 100% rename from src/javacore-analyser/data/xml/javacores/javacore.xsl rename to data/xml/javacores/javacore.xsl diff --git a/src/javacore-analyser/data/xml/report.xsl b/data/xml/report.xsl similarity index 100% rename from src/javacore-analyser/data/xml/report.xsl rename to data/xml/report.xsl diff --git a/src/javacore-analyser/data/xml/threads/thread.xml b/data/xml/threads/thread.xml similarity index 100% rename from src/javacore-analyser/data/xml/threads/thread.xml rename to data/xml/threads/thread.xml diff --git a/src/javacore-analyser/data/xml/threads/thread.xsl b/data/xml/threads/thread.xsl similarity index 100% rename from src/javacore-analyser/data/xml/threads/thread.xsl rename to data/xml/threads/thread.xsl diff --git a/src/javacore-analyser/java_thread.py b/java_thread.py similarity index 100% rename from src/javacore-analyser/java_thread.py rename to java_thread.py diff --git a/src/javacore-analyser/javacore.py b/javacore.py similarity index 100% rename from src/javacore-analyser/javacore.py rename to javacore.py diff --git a/src/javacore-analyser/javacore_analyser_web.py b/javacore_analyser_web.py similarity index 100% rename from src/javacore-analyser/javacore_analyser_web.py rename to javacore_analyser_web.py diff --git a/src/javacore-analyser/javacore_analyzer.py b/javacore_analyzer.py similarity index 100% rename from src/javacore-analyser/javacore_analyzer.py rename to javacore_analyzer.py diff --git a/src/javacore-analyser/javacore_set.py b/javacore_set.py similarity index 96% rename from src/javacore-analyser/javacore_set.py rename to javacore_set.py index 38e3dd3..4d968ea 100644 --- a/src/javacore-analyser/javacore_set.py +++ b/javacore_set.py @@ -14,7 +14,6 @@ from pathlib import Path from xml.dom.minidom import parseString -import importlib_resources from lxml import etree from lxml.etree import XMLSyntaxError @@ -112,20 +111,15 @@ def generate_report_files(self, output_dir): def __create_output_files_structure(self, output_dir): if not os.path.isdir(output_dir): os.mkdir(output_dir) - data_output_dir = output_dir + '/data' - if os.path.isdir(data_output_dir): - shutil.rmtree(data_output_dir, ignore_errors=True) - logging.info("Data dir: " + data_output_dir) - - # In pip package we have to access file by resource, not directly by filename - style_css_resource = importlib_resources.files("javacore-analyser") / "data" / "style.css" - data_dir = os.path.dirname(style_css_resource) - os.mkdir(data_output_dir) - shutil.copytree(data_dir, data_output_dir, dirs_exist_ok=True) + data_dir = output_dir + '/data' + if os.path.isdir(data_dir): + shutil.rmtree(data_dir, ignore_errors=True) + logging.info("Data dir: " + data_dir) + shutil.copytree("data", data_dir, dirs_exist_ok=True) def __generate_htmls_for_threads(self, output_dir, temp_dir_name): self.create_xml_xsl_for_collection(temp_dir_name + "/threads", - output_dir + "/data/xml/threads/thread", + "data/xml/threads/thread", self.threads, "thread") self.generate_htmls_from_xmls_xsls(self.report_xml_file, @@ -134,7 +128,7 @@ def __generate_htmls_for_threads(self, output_dir, temp_dir_name): def __generate_htmls_for_javacores(self, output_dir, temp_dir_name): self.create_xml_xsl_for_collection(temp_dir_name + "/javacores", - output_dir + "/data/xml/javacores/javacore", + "data/xml/javacores/javacore", self.javacores, "") self.generate_htmls_from_xmls_xsls(self.report_xml_file, @@ -463,8 +457,8 @@ def get_javacore_set_in_xml(self): def __create_index_html(input_dir, output_dir): # Copy index.xml and report.xsl to temp - for index.html we don't need to generate anything. Copying is enough. - shutil.copy2(output_dir + "/data/xml/index.xml", input_dir) - shutil.copy2(output_dir + "/data/xml/report.xsl", input_dir) + shutil.copy2("data/xml/index.xml", input_dir) + shutil.copy2("data/xml/report.xsl", input_dir) xslt_doc = etree.parse(input_dir + "/report.xsl") xslt_transformer = etree.XSLT(xslt_doc) diff --git a/src/javacore-analyser/logging_utils.py b/logging_utils.py similarity index 100% rename from src/javacore-analyser/logging_utils.py rename to logging_utils.py diff --git a/src/javacore-analyser/snapshot_collection.py b/snapshot_collection.py similarity index 100% rename from src/javacore-analyser/snapshot_collection.py rename to snapshot_collection.py diff --git a/src/javacore-analyser/snapshot_collection_collection.py b/snapshot_collection_collection.py similarity index 100% rename from src/javacore-analyser/snapshot_collection_collection.py rename to snapshot_collection_collection.py diff --git a/src/javacore-analyser/__init__.py b/src/javacore-analyser/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/javacore-analyser/stack_trace.py b/stack_trace.py similarity index 100% rename from src/javacore-analyser/stack_trace.py rename to stack_trace.py diff --git a/src/javacore-analyser/stack_trace_element.py b/stack_trace_element.py similarity index 100% rename from src/javacore-analyser/stack_trace_element.py rename to stack_trace_element.py diff --git a/src/javacore-analyser/stack_trace_kind.py b/stack_trace_kind.py similarity index 100% rename from src/javacore-analyser/stack_trace_kind.py rename to stack_trace_kind.py diff --git a/src/javacore-analyser/templates/index.html b/templates/index.html similarity index 100% rename from src/javacore-analyser/templates/index.html rename to templates/index.html diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..c0225ff --- /dev/null +++ b/test/__init__.py @@ -0,0 +1,4 @@ +# +# Copyright IBM Corp. 2024 - 2024 +# SPDX-License-Identifier: Apache-2.0 +# \ No newline at end of file diff --git a/test/test_code_snapshot_collection.py b/test/test_code_snapshot_collection.py index 1802483..037cc8e 100644 --- a/test/test_code_snapshot_collection.py +++ b/test/test_code_snapshot_collection.py @@ -5,8 +5,8 @@ import unittest +from code_snapshot_collection import CodeSnapshotCollection from java_thread import Thread -from javacore_analyser.code_snapshot_collection import CodeSnapshotCollection from thread_snapshot import ThreadSnapshot diff --git a/test/test_javacore_analyzer.py b/test/test_javacore_analyzer.py index c174aee..898d201 100644 --- a/test/test_javacore_analyzer.py +++ b/test/test_javacore_analyzer.py @@ -63,7 +63,7 @@ def test_api(self): test_failed = False try: - javacore_analyzer.process_javacores_and_generate_report_data([], "tmp") + javacore_analyzer.process_javacores_and_generate_report_data([],"tmp") except RuntimeError: test_failed = True self.assertTrue(test_failed, "API on missing javacores should fail but finished successfully") diff --git a/src/javacore-analyser/thread_snapshot.py b/thread_snapshot.py similarity index 100% rename from src/javacore-analyser/thread_snapshot.py rename to thread_snapshot.py diff --git a/src/javacore-analyser/tips.py b/tips.py similarity index 100% rename from src/javacore-analyser/tips.py rename to tips.py diff --git a/src/javacore-analyser/verbose_gc.py b/verbose_gc.py similarity index 100% rename from src/javacore-analyser/verbose_gc.py rename to verbose_gc.py