From 4d012e66c2e814261cd00c35fc1b8dc4cbbbe8b8 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 10:53:50 +0100
Subject: [PATCH] Add setup script

* rename directory bin to script
* remove older deploy script
* Configuration are installed as package files
---
 FofbTool/__init__.py      |  2 +-
 README                    |  1 +
 install_rcm.sh            | 21 ---------------------
 {bin => scripts}/FofbTool |  0
 setup.py                  | 18 ++++++++++++++++++
 5 files changed, 20 insertions(+), 22 deletions(-)
 create mode 120000 README
 delete mode 100755 install_rcm.sh
 rename {bin => scripts}/FofbTool (100%)
 create mode 100755 setup.py

diff --git a/FofbTool/__init__.py b/FofbTool/__init__.py
index 24c3af2..d3c8880 100644
--- a/FofbTool/__init__.py
+++ b/FofbTool/__init__.py
@@ -1 +1 @@
-__version__ = "AUTOVERSIONREPLACE"
+__version__ = "2.2"
diff --git a/README b/README
new file mode 120000
index 0000000..bff755a
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+README.adoc
\ No newline at end of file
diff --git a/install_rcm.sh b/install_rcm.sh
deleted file mode 100755
index 10fdc5f..0000000
--- a/install_rcm.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-echo "Deploy module and CLI in RCM environment"
-
-# Get the current version
-version=$(git describe --tags)
-
-# Copy Python module
-ipath=/home/operateur/.local/lib/python3.6/site-packages/FofbTool
-mkdir -p $ipath
-cp FofbTool/*.py $ipath/ -rvf
-cp FofbTool/*.cfg $ipath/ -rvf
-
-# Copy bin CLI
-cp bin/FofbTool /home/production/scripts/DG/python/bin/ -vf
-
-# Put exec rights
-chmod +x /home/production/scripts/DG/python/bin/FofbTool
-
-# AWK the __init__.py file to replace the version variable
-awk -v version="$version" '{ gsub("AUTOVERSIONREPLACE",version) ; print}' FofbTool/__init__.py > $ipath/__init__.py
diff --git a/bin/FofbTool b/scripts/FofbTool
similarity index 100%
rename from bin/FofbTool
rename to scripts/FofbTool
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..75fdb54
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+
+setup(name='FofbTool',
+      version='2.2',
+      description='Python module to operate and configure SOLEIL FOFB.',
+      url='https://gitlab.synchrotron-soleil.fr/dg/fofb/fofbtool',
+      license="GNU-GPL-v3",
+      author='Romain BRONĂˆS',
+      author_email='romain.brones@synchrotron-soleil.fr',
+      packages=['FofbTool',],
+      scripts=['scripts/FofbTool',],
+      package_data={
+          'FofbTool': ['*.cfg'],
+          },
+      install_requires = ['pytango>=9.2', 'numpy>=1.15'],
+     )
-- 
GitLab