From 05df7091b631dacd3d7590c3fb72bbd561ae93c5 Mon Sep 17 00:00:00 2001
From: nd <git@notandy.de>
Date: Fri, 30 Jul 2021 21:47:57 +0200
Subject: [PATCH] package uffd for pip

---
 .gitlab-ci.yml | 10 ++++++++++
 setup.py       | 30 ++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 setup.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 036f0f99..e3385bbc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -71,3 +71,13 @@ trans_de:
   script:
   - ./update_translations.sh de
   coverage: '/^TOTAL.*\s+(\d+\%)$/'
+
+publish-pip:
+  stage: deploy
+  script:
+  - pip3 install build twine
+  - PACKAGE_VERSION="${CI_COMMIT_TAG#v}" python3 -m build
+  - TWINE_USERNAME="${GITLABPKGS_USERNAME}" TWINE_PASSWORD="${GITLABPKGS_PASSWORD}" python3 -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
+  - TWINE_USERNAME="${PYPI_USERNAME}" TWINE_PASSWORD="${PYPI_PASSWORD}" python3 -m twine upload dist/*
+  rules:
+    - if: '$CI_COMMIT_TAG =~ /v[0-9]+[.][0-9]+[.][0-9]+.*/'
diff --git a/setup.py b/setup.py
new file mode 100644
index 00000000..ead7fb04
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,30 @@
+from setuptools import setup, find_packages
+import os
+
+with open('README.md', 'r', encoding='utf-8') as f:
+	long_description = f.read()
+
+setup(
+	name='uffd',
+	version=os.environ.get('PACKAGE_VERSION', 'local'),
+	description='UserFerwaltungsFrontend: Ldap based single sign on and user management web software',
+	long_description=long_description,
+	long_description_content_type='text/markdown',
+	url='https://git.cccv.de/uffd/uffd',
+	classifiers=[
+		'Programming Language :: Python :: 3',
+		'Development Status :: 4 - Beta',
+		'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
+		'Operating System :: OS Independent',
+		'Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP',
+		'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
+		'Environment :: Web Environment',
+		'Framework :: Flask',
+	],
+	author='CCCV',
+	author_email='it@cccv.de',
+	license='AGPL3',
+	packages=find_packages(),
+	zip_safe=False,
+	python_requires='>=3.7',
+)
-- 
GitLab