Compare commits
No commits in common. "bc276b9845dc5b07ceb0ce36ccfa11db5adf88a9" and "bca3f4f3470c84e719d5737637b93ec840721e86" have entirely different histories.
bc276b9845
...
bca3f4f347
5 changed files with 42 additions and 159 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -2,7 +2,3 @@
|
|||
*~
|
||||
mylib.egg-info
|
||||
venv*
|
||||
build
|
||||
dist
|
||||
deb_dist
|
||||
mylib-*.tar.gz
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
pipelines:
|
||||
test:
|
||||
image: debian
|
||||
commands:
|
||||
- apt update
|
||||
- apt -y upgrade
|
||||
- apt install -y python3-all python3-dev python3-pip python3-venv build-essential pkg-config libsystemd-dev libldap2-dev libsasl2-dev libpq-dev libmariadb-dev wget unzip
|
||||
- wget -O /opt/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
|
||||
- unzip -d /opt /opt/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
|
||||
- echo /opt/instantclient_* > /etc/ld.so.conf.d/oracle-instantclient.conf
|
||||
- ldconfig
|
||||
- python3 -m venv venv
|
||||
- source venv/bin/activate
|
||||
- python3 -m pip install -e ".[dev]"
|
||||
- python3 -m pytest tests
|
||||
build:
|
||||
image: debian
|
||||
commands:
|
||||
- apt update
|
||||
- apt -y upgrade
|
||||
- apt -y install --no-install-recommends git sed python3-all python3-dev python3-pip python3-venv dpkg-dev build-essential debhelper dh-python bash-completion lsb-release
|
||||
- ./build.sh
|
||||
- rm -fr deb_dist/python3-mylib-*
|
||||
publish:
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
base_url: https://gitea.zionetrix.net
|
||||
files: dist/* deb_dist/*
|
||||
checksum:
|
||||
- md5
|
||||
- sha512
|
80
build.sh
80
build.sh
|
@ -1,80 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Enter source directory
|
||||
cd $( dirname $0 )
|
||||
|
||||
# Clean previous build
|
||||
rm -fr dist deb_dist
|
||||
|
||||
# Set version in pyproject.toml
|
||||
VERSION="$( git describe --tags )"
|
||||
sed -i "s/^version *=.*$/version = '$VERSION'/" setup.py
|
||||
|
||||
if [ -d venv ]
|
||||
then
|
||||
VENV=$( realpath venv )
|
||||
TEMP_VENV=0
|
||||
else
|
||||
# Install stdeb in temporary venv
|
||||
VENV=$(mktemp -d)
|
||||
echo "Create a temporary virtualenv in $VENV to install build dependencies..."
|
||||
TEMP_VENV=1
|
||||
python3 -m venv $VENV
|
||||
$VENV/bin/python3 -m pip install stdeb GitPython wheel
|
||||
fi
|
||||
|
||||
# Build wheel package
|
||||
$VENV/bin/python3 setup.py bdist_wheel
|
||||
|
||||
# Check gitdch is installed
|
||||
GITDCH=$(which gitdch)
|
||||
set -e
|
||||
if [ -z "$GITDCH" ]
|
||||
then
|
||||
TMP_GITDCH=$(mktemp -d)
|
||||
echo "Temporary install gitdch in $TMP_GITDCH"
|
||||
git clone https://gitea.zionetrix.net/bn8/gitdch.git $TMP_GITDCH/gitdch
|
||||
GITDCH=$TMP_GITDCH/gitdch/gitdch
|
||||
else
|
||||
TMP_GITDCH=""
|
||||
fi
|
||||
|
||||
# Build debian source package
|
||||
$VENV/bin/python3 setup.py --command-packages=stdeb.command sdist_dsc \
|
||||
--package3 "python3-mylib" \
|
||||
--maintainer "Benjamin Renard <brenard@zionetrix.net>" \
|
||||
--compat 10 \
|
||||
--section net \
|
||||
--forced-upstream-version "$VERSION"
|
||||
|
||||
# Keep only debian package directory and orig.tar.gz archive
|
||||
find deb_dist/ -maxdepth 1 -type f ! -name '*.orig.tar.gz' -delete
|
||||
|
||||
# Enter in debian package directory
|
||||
cd deb_dist/mylib-$VERSION
|
||||
|
||||
# Generate EE debian codename
|
||||
DEBIAN_CODENAME=$( lsb_release -c -s )
|
||||
[ $( lsb_release -r -s ) -ge 9 ] && DEBIAN_CODENAME="${DEBIAN_CODENAME}-ee"
|
||||
|
||||
# Generate debian changelog using generate_debian_changelog.py
|
||||
$VENV/bin/python3 $GITDCH \
|
||||
--package-name mylib \
|
||||
--version "${VERSION}" \
|
||||
--code-name $DEBIAN_CODENAME \
|
||||
--output debian/changelog \
|
||||
--path ../../ \
|
||||
--verbose
|
||||
|
||||
# Add custom package name for dependencies
|
||||
cat << EOF > debian/py3dist-overrides
|
||||
cx_oracle python3-cx-oracle
|
||||
EOF
|
||||
|
||||
[ $TEMP_VENV -eq 1 ] && rm -fr $VENV
|
||||
|
||||
# Clean temporary gitdch installation
|
||||
[ -n "$TMP_GITDCH" ] && rm -fr $TMP_GITDCH
|
||||
|
||||
# Build debian package
|
||||
dpkg-buildpackage --no-sign
|
38
setup.py
38
setup.py
|
@ -1,11 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from setuptools import find_packages
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
extras_require={
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
with open(os.path.join(here, 'README.md')) as f:
|
||||
README = f.read()
|
||||
|
||||
setup(
|
||||
name="mylib",
|
||||
version='0.0',
|
||||
long_description=README,
|
||||
classifiers=[
|
||||
'Programming Language :: Python',
|
||||
],
|
||||
install_requires=[
|
||||
'progressbar',
|
||||
],
|
||||
extras_require={
|
||||
'dev': [
|
||||
'pytest',
|
||||
'mocker',
|
||||
|
@ -13,6 +28,7 @@ extras_require={
|
|||
'pylint',
|
||||
],
|
||||
'config': [
|
||||
'configparser',
|
||||
'argcomplete',
|
||||
'keyring',
|
||||
'systemd-python',
|
||||
|
@ -23,6 +39,7 @@ extras_require={
|
|||
'pytz',
|
||||
],
|
||||
'email': [
|
||||
'email3',
|
||||
'mako',
|
||||
],
|
||||
'pgsql': [
|
||||
|
@ -34,24 +51,7 @@ extras_require={
|
|||
'mysql': [
|
||||
'mysqlclient',
|
||||
],
|
||||
}
|
||||
|
||||
install_requires = ['progressbar']
|
||||
for extra, deps in extras_require.items():
|
||||
if extra != 'dev':
|
||||
install_requires.extend(deps)
|
||||
|
||||
version = '0.1'
|
||||
|
||||
setup(
|
||||
name="mylib",
|
||||
version=version,
|
||||
description='A set of helpers small libs to make common tasks easier in my script development',
|
||||
classifiers=[
|
||||
'Programming Language :: Python',
|
||||
],
|
||||
install_requires=install_requires,
|
||||
extras_require=extras_require,
|
||||
},
|
||||
author='Benjamin Renard',
|
||||
author_email='brenard@zionetrix.net',
|
||||
url='https://gogs.zionetrix.net/bn8/python-mylib',
|
||||
|
|
|
@ -307,7 +307,7 @@ def test_delete_just_try(mocker, test_oracledb):
|
|||
def test_truncate(mocker, test_oracledb):
|
||||
mocker.patch(
|
||||
'mylib.oracle.OracleDB.doSQL',
|
||||
generate_mock_doSQL('TRUNCATE TABLE "mytable"', None)
|
||||
generate_mock_doSQL('TRUNCATE "mytable"', None)
|
||||
)
|
||||
|
||||
assert test_oracledb.truncate('mytable')
|
||||
|
|
Loading…
Reference in a new issue