Repository: intel/dffml

Issue:
source: mysql: Setup common borked
```console
(.venv) pdxjohnny@rza maintained $ pip install -r dffml-source-mysql
Requirement already satisfied: dffml==0.3.0 in ./.venv/lib/python3.7/site-packages (from -r packages (line 1)) (0.3.0)                                                            
Collecting dffml-source-mysql==0.0.2 (from -r packages (line 9))                                                                                                                                                                              
  Downloading https://files.pythonhosted.org/packages/f7/af/574a9285e3237b6a4b82b2ccba100d591c31a453b956368de9d09b4d6e9d/dffml-source-mysql-0.0.2.tar.gz                                                                                      
    Complete output from command python setup.py egg_info:                                                                                                                                                                                    
    Traceback (most recent call last):                                                                                                                                                                                                        
      File "<string>", line 1, in <module>                                                                                                                                                                                                    
      File "/tmp/pip-install-7n6qa4kv/dffml-source-mysql/setup.py", line 3, in <module>                                                                                                                                                       
        from dffml_setup_common import SETUP_KWARGS, IMPORT_NAME
    ModuleNotFoundError: No module named 'dffml_setup_common'                                                                                                                                                                                 

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-7n6qa4kv/dffml-source-mysql/                                                                                                                                  
You are using pip version 18.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
```


Discussion:
Re-run `dffml service dev create source dffml-source-mysql`

copy implementation and test files from `source/mysql` into `dffml-source-mysql`

replace `source/mysql` with the newly created `dffml-source-mysql`
I'd like to work on this issue.

Resolving patch:
diff --git a/source/mysql/dffml_source_mysql/version.py b/source/mysql/dffml_source_mysql/version.py
--- a/source/mysql/dffml_source_mysql/version.py
+++ b/source/mysql/dffml_source_mysql/version.py
@@ -1 +1 @@
-VERSION = "0.0.2"
+VERSION = "0.0.3"
diff --git a/source/mysql/setup.py b/source/mysql/setup.py
--- a/source/mysql/setup.py
+++ b/source/mysql/setup.py
@@ -1,11 +1,20 @@
+import os
+import importlib.util
 from setuptools import setup
 
-from dffml_setup_common import SETUP_KWARGS, IMPORT_NAME
+# Boilerplate to load commonalities
+spec = importlib.util.spec_from_file_location(
+    "setup_common", os.path.join(os.path.dirname(__file__), "setup_common.py")
+)
+common = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(common)
 
-SETUP_KWARGS["install_requires"] += ["aiomysql>=0.0.20"]
-SETUP_KWARGS["tests_require"] = ["docker>=4.0.2"]
-SETUP_KWARGS["entry_points"] = {
-    "dffml.source": [f"mysql = {IMPORT_NAME}.source:MySQLSource"]
+common.KWARGS["entry_points"] = {
+    "dffml.source": [f"mysql = {common.IMPORT_NAME}.source:MySQLSource"]
 }
 
-setup(**SETUP_KWARGS)
+common.KWARGS["install_requires"] += ["aiomysql>=0.0.20"]
+
+common.KWARGS["tests_require"] = ["docker>=4.0.2"]
+
+setup(**common.KWARGS)
diff --git a/source/mysql/dffml_setup_common.py b/source/mysql/setup_common.py
similarity index 99%
rename from source/mysql/dffml_setup_common.py
rename to source/mysql/setup_common.py
--- a/source/mysql/dffml_setup_common.py
+++ b/source/mysql/setup_common.py
@@ -50,7 +50,7 @@
 
 README = Path(SELF_PATH, "README.md").read_text()
 
-SETUP_KWARGS = dict(
+KWARGS = dict(
     name=NAME,
     version=VERSION,
     description=DESCRIPTION,


Test patch: