cleanup repository tree. use entry_points in setuptools instead of symlink

This commit is contained in:
Edwin Eefting 2021-02-07 13:00:04 +01:00
parent 0214584e4c
commit 4f9b7b6cef
21 changed files with 27 additions and 69 deletions

View File

@ -21,7 +21,7 @@ jobs:
- name: Regression test
run: sudo -E ./run_tests
run: sudo -E ./tests/run_tests
- name: Coveralls
@ -43,7 +43,7 @@ jobs:
- name: Regression test
run: sudo -E ./run_tests
run: sudo -E ./tests/run_tests
- name: Coveralls

3
.gitignore vendored
View File

@ -9,3 +9,6 @@ __pycache__
.coverage
*.pyc
python2.env
venv
.idea
OQ

View File

@ -1,32 +0,0 @@
#MOVING TO GITHUB ACTIONS
# jobs:
# include:
# - os: linux
# dist: xenial
# language: python
# python: 2.7
# - os: linux
# dist: xenial
# language: python
# python: 3.6
# - os: linux
# dist: bionic
# language: python
# python: 2.7
# - os: linux
# dist: bionic
# language: python
# python: 3.6
# before_install:
# - sudo apt-get update
# - sudo apt-get install zfsutils-linux
# script:
# # - sudo -E ./ngrok.sh
# - sudo -E ./run_tests
# # - sudo -E pip --version

View File

View File

@ -1 +0,0 @@
zfs-autobackup

View File

@ -1,17 +0,0 @@
#!/bin/bash
if ! [ -e ngrok ]; then
wget -O ngrok.zip https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok.zip
fi
{
mkfifo pipe
echo "Executing nc"
nc -k -l -v 8888 <pipe | ( while true; do bash >pipe 2>&1; echo "restarting" ;sleep 1; done )
killall -SIGINT ngrok && echo "ngrok terminated"
} &
{
echo "Executing ngrok"
./ngrok authtoken $NGROK_TOKEN
./ngrok tcp 8888 --log=stdout
} &
wait

View File

@ -1,14 +1,13 @@
import setuptools
import bin.zfs_autobackup
import zfs_autobackup
import os
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="zfs_autobackup",
version=bin.zfs_autobackup.VERSION,
version=zfs_autobackup.VERSION,
author="Edwin Eefting",
author_email="edwin@datux.nl",
description="ZFS autobackup is used to periodicly backup ZFS filesystems to other locations. It tries to be the most friendly to use and easy to debug ZFS backup tool.",
@ -16,8 +15,14 @@ setuptools.setup(
long_description_content_type="text/markdown",
url="https://github.com/psy0rz/zfs_autobackup",
scripts=["bin/zfs-autobackup"],
entry_points={
'console_scripts':
[
'zfs-autobackup = zfs_autobackup:cli',
]
},
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",

View File

@ -8,7 +8,7 @@ import unittest2
import subprocess
import time
from pprint import *
from bin.zfs_autobackup import *
from zfs_autobackup import *
from mock import *
import contextlib
import sys

View File

@ -1,4 +1,8 @@
#!/bin/bash
#!/bin/bash
SCRIPTDIR=`dirname $0`
#cd $SCRIPTDIR || exit 1
if [ "$USER" != "root" ]; then
@ -6,8 +10,6 @@ if [ "$USER" != "root" ]; then
exit 1
fi
#reactivate python environment, if any (usefull in Travis)
[ "$VIRTUAL_ENV" ] && source $VIRTUAL_ENV/bin/activate
# test needs ssh access to localhost for testing
if ! [ -e /root/.ssh/id_rsa ]; then
@ -16,16 +18,11 @@ if ! [ -e /root/.ssh/id_rsa ]; then
ssh -oStrictHostKeyChecking=no localhost true || exit 1
fi
coverage run --source bin.zfs_autobackup -m unittest discover -vvvvf $@ 2>&1
coverage run --source zfs_autobackup -m unittest discover -vvvvf $SCRIPTDIR $@ 2>&1
EXIT=$?
echo
coverage report
#this does automatic travis CI/https://coveralls.io/ intergration:
# if which coveralls > /dev/null; then
# echo "Submitting to coveralls.io:"
# coveralls
# fi
exit $EXIT

View File

@ -1,6 +1,5 @@
from basetest import *
import time
from bin.zfs_autobackup import *
run_orig=ExecuteNode.run
run_counter=0

View File

@ -1915,6 +1915,6 @@ class ZfsAutobackup:
return 255
if __name__ == "__main__":
def cli():
zfs_autobackup = ZfsAutobackup(sys.argv[1:], False)
sys.exit(zfs_autobackup.run())

4
zfs_autobackup/__main__.py Executable file
View File

@ -0,0 +1,4 @@
if __name__ == "__main__":
from . import cli
cli()