From 72bf001bcb100934038e14351d9e2cae6f88cd8e Mon Sep 17 00:00:00 2001
From: Carles Garcia Cabot <carles.garcia.cabot@cern.ch>
Date: Thu, 13 Feb 2020 14:02:26 +0100
Subject: [PATCH 1/6] Add setup.py - pipcompile generates requires

---
 .gitignore          |  1 +
 dev-requirements.in |  2 ++
 pipcompile.sh       |  1 +
 setup.py            | 56 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 60 insertions(+)
 create mode 100644 setup.py

diff --git a/.gitignore b/.gitignore
index d3862bf4..479bf443 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 .idea/
 requirements.txt
 dev-requirements.txt
+install_requires.txt
 
 # Byte-compiled / optimized / DLL files
 __pycache__/
diff --git a/dev-requirements.in b/dev-requirements.in
index b411d46b..4a8f49f9 100644
--- a/dev-requirements.in
+++ b/dev-requirements.in
@@ -4,5 +4,7 @@ black
 pylint
 bandit
 radon
+setuptools
+wheel
 #pytest
 #coverage
diff --git a/pipcompile.sh b/pipcompile.sh
index 98c248e9..92a2d06b 100644
--- a/pipcompile.sh
+++ b/pipcompile.sh
@@ -1,3 +1,4 @@
 #!/bin/sh
 pip-compile --generate-hashes requirements.in
 pip-compile --generate-hashes dev-requirements.in
+pip-compile requirements.in --output-file install_requires.txt
diff --git a/setup.py b/setup.py
new file mode 100644
index 00000000..c85f07ff
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,56 @@
+"""A setuptools based setup module.
+
+See:
+https://packaging.python.org/guides/distributing-packages-using-setuptools/
+https://github.com/pypa/sampleproject
+"""
+from setuptools import setup, find_namespace_packages
+from os import path
+from glob import glob
+
+here = path.abspath(path.dirname(__file__))
+
+
+def get_install_requires(pinned=False):
+    packages = []
+    try:
+        with open("install_requires.txt") as requires_file:
+            for line in requires_file:
+                line = line.strip()
+                if not line.startswith("#"):
+                    if pinned:
+                        package = line.split(" ")[0]
+                    else:
+                        package = line.split("==")[0]
+                    packages.append(package)
+    except IOError:
+        raise
+    return packages
+
+
+# Arguments marked as "Required" below must be included for upload to PyPI.
+# Fields marked as "Optional" may be commented out.
+setup(
+    name="fts-rest-flask",  # Required
+    version="0.1",  # Required
+    description="fts-rest in Flask and Python3",  # Optional
+    url="https://gitlab.cern.ch/fts/fts-rest-flask",  # Optional
+    author="CERN -- FTS team",  # Optional
+    author_email="fts-devel@cern.ch",  # Optional
+    classifiers=[  # Optional
+        "Development Status :: 3 - Alpha",
+        "Environment :: Console",
+        "Framework :: Flask",
+        "License :: OSI Approved :: Apache Software License",
+        "Operating System :: POSIX :: Linux",
+        "Programming Language :: Python :: Implementation :: CPython",
+        "Programming Language :: Python :: 3.6",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
+    ],
+    package_dir={"": "src"},  # Optional
+    packages=find_namespace_packages(where="src"),  # Required
+    python_requires=">=3.6",
+    install_requires=get_install_requires(),  # Optional
+    scripts=glob(path.join(here, "src", "cli", "fts-*")),
+)
-- 
GitLab


From f361352cba32aa3376daa43e3d6b8981cacb9702 Mon Sep 17 00:00:00 2001
From: Carles Garcia Cabot <carles.garcia.cabot@cern.ch>
Date: Thu, 13 Feb 2020 14:36:56 +0100
Subject: [PATCH 2/6] Add correct dependencies

---
 setup.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index c85f07ff..b96ad282 100644
--- a/setup.py
+++ b/setup.py
@@ -49,8 +49,14 @@ setup(
         "Programming Language :: Python :: 3.8",
     ],
     package_dir={"": "src"},  # Optional
-    packages=find_namespace_packages(where="src"),  # Required
+    packages=[
+        "fts3",
+        "fts3.rest",
+        "fts3.cli",
+        "fts3.rest.client",
+        "fts3.rest.client.easy",
+    ],  # Required
     python_requires=">=3.6",
-    install_requires=get_install_requires(),  # Optional
+    install_requires=["M2Crypto", "requests"],  # Optional
     scripts=glob(path.join(here, "src", "cli", "fts-*")),
 )
-- 
GitLab


From c78dff1ecec8a4cbf17d393ad1e79768c30ba6a1 Mon Sep 17 00:00:00 2001
From: Carles Garcia Cabot <carles.garcia.cabot@cern.ch>
Date: Thu, 13 Feb 2020 18:10:27 +0100
Subject: [PATCH 3/6] Change package name and add OS requirements

---
 setup.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index b96ad282..d748bb34 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ from glob import glob
 
 here = path.abspath(path.dirname(__file__))
 
-
+# this is not really needed for this package
 def get_install_requires(pinned=False):
     packages = []
     try:
@@ -31,16 +31,15 @@ def get_install_requires(pinned=False):
 # Arguments marked as "Required" below must be included for upload to PyPI.
 # Fields marked as "Optional" may be commented out.
 setup(
-    name="fts-rest-flask",  # Required
+    name="fts-rest-py3",  # Required
     version="0.1",  # Required
-    description="fts-rest in Flask and Python3",  # Optional
+    description="FTS Python3 CLI and libraries",  # Optional
     url="https://gitlab.cern.ch/fts/fts-rest-flask",  # Optional
     author="CERN -- FTS team",  # Optional
     author_email="fts-devel@cern.ch",  # Optional
     classifiers=[  # Optional
         "Development Status :: 3 - Alpha",
         "Environment :: Console",
-        "Framework :: Flask",
         "License :: OSI Approved :: Apache Software License",
         "Operating System :: POSIX :: Linux",
         "Programming Language :: Python :: Implementation :: CPython",
@@ -60,3 +59,6 @@ setup(
     install_requires=["M2Crypto", "requests"],  # Optional
     scripts=glob(path.join(here, "src", "cli", "fts-*")),
 )
+
+# The following OS packages are required for M2Crypto:
+# python3-devel openssl-devel swig gcc gcc-c++ make
-- 
GitLab


From d0102d72fb0273924132d3d65332aa8b5b2e453c Mon Sep 17 00:00:00 2001
From: Carles Garcia Cabot <carles.garcia.cabot@cern.ch>
Date: Tue, 5 May 2020 13:48:22 +0200
Subject: [PATCH 4/6] Update setup.py

---
 setup.py | 69 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 40 insertions(+), 29 deletions(-)

diff --git a/setup.py b/setup.py
index d748bb34..af004458 100644
--- a/setup.py
+++ b/setup.py
@@ -1,44 +1,29 @@
-"""A setuptools based setup module.
-
-See:
-https://packaging.python.org/guides/distributing-packages-using-setuptools/
-https://github.com/pypa/sampleproject
+""""
+SYSTEM REQUIREMENTS:
+The following Centos packages are required for M2Crypto:
+python3-devel openssl-devel swig gcc-c++
 """
+
+# A setuptools based setup module. See:
+# https://packaging.python.org/guides/distributing-packages-using-setuptools/
+# https://github.com/pypa/sampleproject
+
 from setuptools import setup, find_namespace_packages
 from os import path
 from glob import glob
 
 here = path.abspath(path.dirname(__file__))
 
-# this is not really needed for this package
-def get_install_requires(pinned=False):
-    packages = []
-    try:
-        with open("install_requires.txt") as requires_file:
-            for line in requires_file:
-                line = line.strip()
-                if not line.startswith("#"):
-                    if pinned:
-                        package = line.split(" ")[0]
-                    else:
-                        package = line.split("==")[0]
-                    packages.append(package)
-    except IOError:
-        raise
-    return packages
-
-
 # Arguments marked as "Required" below must be included for upload to PyPI.
-# Fields marked as "Optional" may be commented out.
 setup(
-    name="fts-rest-py3",  # Required
-    version="0.1",  # Required
+    name="fts-client-py3",  # Required
+    version="1",  # Required
     description="FTS Python3 CLI and libraries",  # Optional
     url="https://gitlab.cern.ch/fts/fts-rest-flask",  # Optional
     author="CERN -- FTS team",  # Optional
     author_email="fts-devel@cern.ch",  # Optional
     classifiers=[  # Optional
-        "Development Status :: 3 - Alpha",
+        "Development Status :: 4 - Beta",
         "Environment :: Console",
         "License :: OSI Approved :: Apache Software License",
         "Operating System :: POSIX :: Linux",
@@ -60,5 +45,31 @@ setup(
     scripts=glob(path.join(here, "src", "cli", "fts-*")),
 )
 
-# The following OS packages are required for M2Crypto:
-# python3-devel openssl-devel swig gcc gcc-c++ make
+
+# python2 setup
+# setup(
+#     name='fts3-rest',
+#     version='3.10.0',
+#     description='FTS3 Python Libraries',
+#     long_description='FTS3 Python Libraries',
+#     author='FTS3 Developers',
+#     author_email='fts-devel@cern.ch',
+#     url='http://fts.web.cern.ch/',
+#     download_url='https://gitlab.cern.ch/fts/fts-rest',
+#     license='Apache 2',
+#     packages=['fts3', 'fts3.cli', 'fts3.model', 'fts3.rest', 'fts3.rest.client', 'fts3.rest.client.easy'],
+#     package_dir={'fts3': os.path.join(base_dir, 'src', 'fts3')},
+#     scripts=glob(os.path.join(base_dir, 'src', 'cli', 'fts-*')),
+#     keywords='fts3, grid, rest api, data management clients',
+#     platforms=['GNU/Linux'],
+#     classifiers=[
+#         "Intended Audience :: Developers",
+#         "Topic :: Software Development :: Libraries :: Python Modules",
+#         "License :: OSI Approved :: Apache Software License",
+#         "Development Status :: 5 - Production/Stable",
+#         "Operating System :: Unix",
+#         "Programming Language :: Python"
+#     ],
+#
+#     install_requires=['M2Crypto>=0.16', 'pycurl%s' % pycurl_ver, 'requests']
+# )
-- 
GitLab


From 9181f66ccbbf639dd11405fffc90e9ed8a6aa7ef Mon Sep 17 00:00:00 2001
From: Carles Garcia Cabot <carles.garcia.cabot@cern.ch>
Date: Tue, 5 May 2020 13:52:53 +0200
Subject: [PATCH 5/6] update

---
 setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index af004458..81c70027 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ python3-devel openssl-devel swig gcc-c++
 # https://packaging.python.org/guides/distributing-packages-using-setuptools/
 # https://github.com/pypa/sampleproject
 
-from setuptools import setup, find_namespace_packages
+from setuptools import setup
 from os import path
 from glob import glob
 
-- 
GitLab


From b013342eb63d913a2e19049eb3292e0b854fe84a Mon Sep 17 00:00:00 2001
From: Carles Garcia Cabot <carles.garcia.cabot@cern.ch>
Date: Tue, 5 May 2020 14:44:12 +0200
Subject: [PATCH 6/6] add build to CI

---
 .gitlab-ci.yml | 18 +++++++++---------
 setup.py       | 29 -----------------------------
 2 files changed, 9 insertions(+), 38 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6892dde9..000eb128 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,7 +13,7 @@ stages:
   - static_code_analysis
   - tests
   - security
-  - schedule
+  - build
 
 black:
   # Check that every file has been formatted with black
@@ -114,12 +114,12 @@ bandit:
   script:
   - bandit -r src/
 
-bandit_schedule:
-  # Find potential security issues in file. 
-  # It's allowed to fail as it may detect false positives.
-  allow_failure: true
-  stage: schedule
-  only:
-    - schedules
+wheel:
+  stage: build
+  script:
+  - python3 setup.py bdist_wheel
+
+sdist:
+  stage: build
   script:
-  - bandit -r src/
\ No newline at end of file
+  - python3 setup.py sdist
diff --git a/setup.py b/setup.py
index 81c70027..e9edadff 100644
--- a/setup.py
+++ b/setup.py
@@ -44,32 +44,3 @@ setup(
     install_requires=["M2Crypto", "requests"],  # Optional
     scripts=glob(path.join(here, "src", "cli", "fts-*")),
 )
-
-
-# python2 setup
-# setup(
-#     name='fts3-rest',
-#     version='3.10.0',
-#     description='FTS3 Python Libraries',
-#     long_description='FTS3 Python Libraries',
-#     author='FTS3 Developers',
-#     author_email='fts-devel@cern.ch',
-#     url='http://fts.web.cern.ch/',
-#     download_url='https://gitlab.cern.ch/fts/fts-rest',
-#     license='Apache 2',
-#     packages=['fts3', 'fts3.cli', 'fts3.model', 'fts3.rest', 'fts3.rest.client', 'fts3.rest.client.easy'],
-#     package_dir={'fts3': os.path.join(base_dir, 'src', 'fts3')},
-#     scripts=glob(os.path.join(base_dir, 'src', 'cli', 'fts-*')),
-#     keywords='fts3, grid, rest api, data management clients',
-#     platforms=['GNU/Linux'],
-#     classifiers=[
-#         "Intended Audience :: Developers",
-#         "Topic :: Software Development :: Libraries :: Python Modules",
-#         "License :: OSI Approved :: Apache Software License",
-#         "Development Status :: 5 - Production/Stable",
-#         "Operating System :: Unix",
-#         "Programming Language :: Python"
-#     ],
-#
-#     install_requires=['M2Crypto>=0.16', 'pycurl%s' % pycurl_ver, 'requests']
-# )
-- 
GitLab