From 15503ca9feb3120ba66047cf87f5848b5d0a9472 Mon Sep 17 00:00:00 2001
From: Alice BRENON <alice.brenon@ens-lyon.fr>
Date: Mon, 6 Dec 2021 22:01:23 +0100
Subject: [PATCH] Turn the repos into a (hopefully) proper python package

---
 .gitignore                                        |  1 +
 comparator.py                                     |  8 +++++---
 ene_comparator/__init__.py                        |  2 ++
 editDistance.py => ene_comparator/editDistance.py |  0
 sequence.py => ene_comparator/sequence.py         |  0
 setup.py                                          | 14 ++++++++++++++
 6 files changed, 22 insertions(+), 3 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 ene_comparator/__init__.py
 rename editDistance.py => ene_comparator/editDistance.py (100%)
 rename sequence.py => ene_comparator/sequence.py (100%)
 create mode 100644 setup.py

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d20b64
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.pyc
diff --git a/comparator.py b/comparator.py
index 453af32..d1f44ad 100755
--- a/comparator.py
+++ b/comparator.py
@@ -1,8 +1,7 @@
 #!/usr/bin/python3
 
 import argparse
-from sequence import eNESequence
-from editDistance import Metric
+from ene_comparator import eNESequence, Metric
 from sys import argv
 
 def getArgs():
@@ -29,7 +28,7 @@ def getMetric(args):
     otherWeight = args.otherWeight or 0.
     return Metric(missingENE, missingType, wrongType, namesWeight, otherWeight)
 
-if __name__ == '__main__':
+def main():
     args = getArgs()
     print(args)
     m = getMetric(args)
@@ -38,3 +37,6 @@ if __name__ == '__main__':
     print([str(s) for s in leftSequence])
     print([str(s) for s in rightSequence])
     print(m.differences(leftSequence, rightSequence))
+
+if __name__ == '__main__':
+    main()
diff --git a/ene_comparator/__init__.py b/ene_comparator/__init__.py
new file mode 100644
index 0000000..41ea9c2
--- /dev/null
+++ b/ene_comparator/__init__.py
@@ -0,0 +1,2 @@
+from .editDistance import Metric
+from .sequence import eNESequence
diff --git a/editDistance.py b/ene_comparator/editDistance.py
similarity index 100%
rename from editDistance.py
rename to ene_comparator/editDistance.py
diff --git a/sequence.py b/ene_comparator/sequence.py
similarity index 100%
rename from sequence.py
rename to ene_comparator/sequence.py
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..5633a7a
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,14 @@
+from distutils.core import setup
+
+setup(
+        name="ENE-comparator",
+        version="0.1.0",
+        description="yeah, maybe",
+        author="Alice Brenon",
+        author_email="alice.brenon@liris.cnrs.fr",
+        url="https://gitlab.liris.cnrs.fr/abrenon/ene-comparator",
+        packages=["ene_comparator"],
+        install_requires=['lxml'],
+        scripts=['comparator.py'],
+        )
+
-- 
GitLab