From 5833728889c6210082f81bd6962d0ab6a3b74b00 Mon Sep 17 00:00:00 2001 From: Arya Reais-Parsi Date: Sat, 5 Dec 2020 14:55:06 -0800 Subject: [PATCH 1/2] add warning about config file naming put a box around the warning try to fix the box around the warning unsure if this is how you make the box work this table needs less emphasis that didn't work; will this? that was all bad, this is good ok this is definitely it please these warnings don't look bad. make the other one look the same --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6b948ef..53071aba 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ We have included the most recent SCN4M_SUBM design rules from [Qflow]. ## Docker Image -**WARNING! Some OpenRAM dependency tools installed in the Docker image are out-of-date.** +> :warning: **WARNING!** Some OpenRAM dependency tools installed in the Docker image are out-of-date. We have a pre-configured Ubuntu [Docker](https://www.docker.com/) image available that has all tools installed for the [SCMOS] process. It is @@ -142,6 +142,11 @@ python3 $OPENRAM_HOME/openram.py myconfig You can see all of the options for the configuration file in $OPENRAM\_HOME/options.py +> :warning: **WARNING!** Config files are imported as Python modules, which +must adhere to the [requirements for naming Python +modules](https://docs.python.org/3/reference/simple_stmts.html#the-import-statement). +In particular, you cannot use a period or any special characters other than an +underscore. Try using 'p' instead of a period. # Unit Tests From 9eb2f3c0e6b554aaba1d9080327b6a18c3cf91a7 Mon Sep 17 00:00:00 2001 From: Arya Reais-Parsi Date: Tue, 8 Dec 2020 10:43:29 -0800 Subject: [PATCH 2/2] add error message when configuration files are not valid python module names --- compiler/globals.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/globals.py b/compiler/globals.py index f5c42dc0..b1cc92c4 100644 --- a/compiler/globals.py +++ b/compiler/globals.py @@ -295,6 +295,14 @@ def read_config(config_file, is_unit_test=True): dir_name = os.path.dirname(config_file) module_name = os.path.basename(config_file) + # Check that the module name adheres to Python's module naming conventions. + # This will assist the user in interpreting subsequent errors in loading + # the module. Valid Python module naming is described here: + # https://docs.python.org/3/reference/simple_stmts.html#the-import-statement + if not module_name.isidentifier(): + debug.error("Configuration file name is not a valid Python module name: " + "{0}. It should be a valid identifier.".format(module_name)) + # Prepend the path to avoid if we are using the example config sys.path.insert(0, dir_name) # Import the configuration file of which modules to use