Commit ffa0d4cc authored by Raphael Guntersweiler's avatar Raphael Guntersweiler

Merge branch 'release/0.2.1'

parents f0abf89f 8615c850
Pipeline #38693454 passed with stage
in 28 seconds
# Following the example of:
# https://medium.com/@pypripackages/using-gitlab-pipelines-to-deploy-python-packages-in-production-and-staging-environments-8ab7dc979274
image: python:3.6-alpine
stages:
- deploy
before_script:
- pip install twine
- pip install mdToRst
- python setup.py sdist
deploy_develop:
stage: deploy
variables:
TWINE_USERNAME: $PIP_USERNAME
TWINE_PASSWORD: $PIP_PASSWORD
script:
- twine upload --verbose dist/*
only:
- develop
deploy_release_candidate:
stage: deploy
variables:
TWINE_USERNAME: $PIP_USERNAME
TWINE_PASSWORD: $PIP_PASSWORD
script:
- twine upload --verbose dist/*
only:
- /release\/([^\/]*)$/
deploy_release:
stage: deploy
variables:
TWINE_USERNAME: $PIP_USERNAME
TWINE_PASSWORD: $PIP_PASSWORD
script:
- twine upload dist/*
only:
- tags
include README.md
include LICENSE
include VERSION.txt
include SHORT_DESCRIPTION.txt
A library providing utilities for writing CarPi Python daemons.
\ No newline at end of file
0.2.1
\ No newline at end of file
......@@ -4,29 +4,91 @@ CARPI DAEMON COMMONS
Licensed under MIT
"""
import os
from datetime import datetime
from time import time
from setuptools import setup
with open('README.md', 'r') as f:
long_description = f.read()
setup(name='carpi-daemoncommons',
version='0.2.0',
description='A library providing utilities for writing Python daemons.',
long_description=long_description,
url='https://github.com/rGunti/CarPi-DaemonCommons',
keywords='carpi daemon',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.6'
],
author='Raphael "rGunti" Guntersweiler',
author_email='raphael@rgunti.ch',
license='MIT',
packages=['daemoncommons'],
install_requires=[
'carpi-commons',
'wheel'
],
# ### READING DOCUMENTATION TO RST #########################
def convert_md_to_rst(file: str):
with open(file, 'r') as f:
return f.read()
# ### READING VERSION.txt NUMBER ###############################
def read_version():
with open('VERSION.txt', 'r') as f:
return f.read().strip()
def get_version():
build_time = datetime.fromtimestamp(time())
base_ver = read_version()
if 'CI_BUILD_REF_NAME' in os.environ:
branch = os.environ['CI_BUILD_REF_NAME']
if branch == "develop":
# Develop Build
return '{}.dev{}'.format(base_ver,
build_time.strftime('%y%m%d%H%M%S'))
elif branch.startswith('release/'):
# Release Candidate Build
base_ver = branch.split('/')[1]
return "{}rc{}".format(base_ver,
build_time.strftime('%y%m%d%H%M%S'))
else:
# Release Build
return os.environ['CI_BUILD_REF_NAME']
else:
return '{}.dev{}'.format(base_ver,
build_time.strftime('%y%m%d%H%M%S'))
# ### PRINTING ENVIRONMENT VARIABLES #######################
# for key, val in os.environ.items():
# print(" -- ENV {} = {}".format(key, val))
# ### DEFINING PROJECT PROPERTIES ##########################
NAME = "carpi-daemoncommons"
VERSION = get_version()
DESCRIPTION = open('SHORT_DESCRIPTION.txt', 'r').read()
LONG_DESCRIPTION = convert_md_to_rst('README.md')
AUTHOR = "rGunti"
AUTHOR_EMAIL = "raphael@rgunti.ch"
LICENSE = "MIT"
URL = "https://gitlab.com/rGunti/CarPi-DaemonCommons"
PACKAGES = [
'daemoncommons'
]
DEPENDENCIES = [
'wheel',
'carpi-commons'
]
OPTIONAL_DEPENDENCIES = {}
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.6'
]
# ### BUILDING #############################################
print(" >> Building {} Ver. {}".format(NAME, VERSION))
setup(name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license=LICENSE,
packages=PACKAGES,
install_requires=DEPENDENCIES,
extras_require=OPTIONAL_DEPENDENCIES,
classifiers=CLASSIFIERS,
url=URL,
zip_safe=False,
include_package_data=True)
include_packaged_data=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment