From 38049a9eff9ee0d6d33e641d5cedc2e57036ae2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20Bron=C3=A8s?= <romain.brones@synchrotron-soleil.fr>
Date: Thu, 22 Feb 2024 12:35:36 +0100
Subject: [PATCH] chore(setup): Add proper setup.py

* remove old deploy script
---
 ArchiveExtractor/__init__.py | 19 +++++++++++++++++--
 README                       |  1 +
 deploy_rcm.sh                | 16 ----------------
 setup.py                     | 14 ++++++++++++++
 4 files changed, 32 insertions(+), 18 deletions(-)
 create mode 120000 README
 delete mode 100755 deploy_rcm.sh
 create mode 100755 setup.py

diff --git a/ArchiveExtractor/__init__.py b/ArchiveExtractor/__init__.py
index 196a71e..99f2b13 100644
--- a/ArchiveExtractor/__init__.py
+++ b/ArchiveExtractor/__init__.py
@@ -1,8 +1,23 @@
 """
-Python module for extracting attribute from Archive Extractor Device.
+Python module for extracting data from Archive Extractor Tango Device.
+
+Example scripts available on GitLab: https://gitlab.synchrotron-soleil.fr/dg/archiveextractor/-/tree/main/examples
+
+Main functions
+    * findattr
+        Look into the list of archived attributes for matching names.
+    * extract
+        Entry point function for data extraction.
+
+Quick usage in ipython shell:
+
+    In [1]: import ArchiveExtractor as AE
+    In [2]: AE.findattr("ans/dg/*dcct*")
+    In [3]: AE.extract('ANS/DG/DCCT-CTRL/current', '2021-12-13', '2021-12-13-12:00', method='between')
+
 """
 
-__version__ = "AUTOVERSIONREPLACE"
+__version__ = "2.1"
 
 __all__ = ["Access", ]
 
diff --git a/README b/README
new file mode 120000
index 0000000..42061c0
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+README.md
\ No newline at end of file
diff --git a/deploy_rcm.sh b/deploy_rcm.sh
deleted file mode 100755
index b6fdeeb..0000000
--- a/deploy_rcm.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-echo "Deploy module in RCM environment"
-
-
-# Get the current version
-version=$(git describe --tags)
-
-# Copy Python module
-ipath=/home/operateur/.local/lib/python3.6/site-packages/ArchiveExtractor
-mkdir -p $ipath
-cp ArchiveExtractor/*.py $ipath/ -rvf
-
-# cwAWKSed the __init__.py file to replace the version variable
-awk -v version="$version" '{ gsub("AUTOVERSIONREPLACE",version) ; print}' ArchiveExtractor/__init__.py > $ipath/__init__.py
-
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..25df40f
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+
+setup(name='ArchiveExtractor',
+      version='2.1',
+      description='Python module for extracting data from Archive Extractor Tango Device.',
+      url='https://gitlab.synchrotron-soleil.fr/dg/archiveextractor',
+      license="GNU-GPL-v3",
+      author='Romain BRONĂˆS',
+      author_email='romain.brones@synchrotron-soleil.fr',
+      packages=['ArchiveExtractor',],
+      install_requires = ['pytango>=9.2', 'numpy>=1.15', 'pandas>=1.1'],
+     )
-- 
GitLab