From ba3c34c7a7213c1db199d58ed4c5d0b6a558a23e Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Tue, 28 Sep 2021 12:17:53 +0200 Subject: [PATCH 1/7] pip installable, but not correct --- bump-version.sh | 2 ++ {src => data}/etc/command_help.txt | 0 {src => data}/etc/docker-compose_default.yml | 0 {src => data}/etc/kiwi_default.yml | 0 {src => data}/etc/kiwi_header.yml | 0 {src => data}/etc/kiwi_help.txt | 0 {src => data}/etc/version_tag | 0 {src => data}/images/rsync.Dockerfile | 0 {src/kiwi => kiwi_scp}/__init__.py | 0 {src/kiwi => kiwi_scp}/_constants.py | 0 {src/kiwi => kiwi_scp}/config.py | 0 {src/kiwi => kiwi_scp}/executable.py | 3 --- {src/kiwi => kiwi_scp}/misc.py | 0 {src/kiwi => kiwi_scp}/parser.py | 0 {src/kiwi => kiwi_scp}/project.py | 0 {src/kiwi => kiwi_scp}/projects.py | 2 +- {src/kiwi => kiwi_scp}/rootkit.py | 0 {src/kiwi => kiwi_scp}/runner.py | 0 kiwi_scp/scripts/__init__.py | 0 src/kiwi-scp.py => kiwi_scp/scripts/kiwi.py | 6 ++--- {src/kiwi => kiwi_scp}/subcommand.py | 0 .../kiwi => kiwi_scp}/subcommands/__init__.py | 0 {src/kiwi => kiwi_scp}/subcommands/_hidden.py | 1 - {src/kiwi => kiwi_scp}/subcommands/build.py | 0 {src/kiwi => kiwi_scp}/subcommands/cmd.py | 0 {src/kiwi => kiwi_scp}/subcommands/disable.py | 0 {src/kiwi => kiwi_scp}/subcommands/down.py | 0 {src/kiwi => kiwi_scp}/subcommands/enable.py | 0 {src/kiwi => kiwi_scp}/subcommands/init.py | 0 {src/kiwi => kiwi_scp}/subcommands/logs.py | 0 {src/kiwi => kiwi_scp}/subcommands/new.py | 0 {src/kiwi => kiwi_scp}/subcommands/pull.py | 0 {src/kiwi => kiwi_scp}/subcommands/purge.py | 0 {src/kiwi => kiwi_scp}/subcommands/push.py | 0 {src/kiwi => kiwi_scp}/subcommands/restart.py | 0 {src/kiwi => kiwi_scp}/subcommands/shell.py | 0 {src/kiwi => kiwi_scp}/subcommands/show.py | 0 {src/kiwi => kiwi_scp}/subcommands/up.py | 0 {src/kiwi => kiwi_scp}/subcommands/update.py | 0 setup.py | 23 +++++++++++++++++++ 40 files changed, 29 insertions(+), 8 deletions(-) rename {src => data}/etc/command_help.txt (100%) rename {src => data}/etc/docker-compose_default.yml (100%) rename {src => data}/etc/kiwi_default.yml (100%) rename {src => data}/etc/kiwi_header.yml (100%) rename {src => data}/etc/kiwi_help.txt (100%) rename {src => data}/etc/version_tag (100%) rename {src => data}/images/rsync.Dockerfile (100%) rename {src/kiwi => kiwi_scp}/__init__.py (100%) rename {src/kiwi => kiwi_scp}/_constants.py (100%) rename {src/kiwi => kiwi_scp}/config.py (100%) rename {src/kiwi => kiwi_scp}/executable.py (97%) rename {src/kiwi => kiwi_scp}/misc.py (100%) rename {src/kiwi => kiwi_scp}/parser.py (100%) rename {src/kiwi => kiwi_scp}/project.py (100%) rename {src/kiwi => kiwi_scp}/projects.py (98%) rename {src/kiwi => kiwi_scp}/rootkit.py (100%) rename {src/kiwi => kiwi_scp}/runner.py (100%) create mode 100644 kiwi_scp/scripts/__init__.py rename src/kiwi-scp.py => kiwi_scp/scripts/kiwi.py (88%) rename {src/kiwi => kiwi_scp}/subcommand.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/__init__.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/_hidden.py (98%) rename {src/kiwi => kiwi_scp}/subcommands/build.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/cmd.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/disable.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/down.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/enable.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/init.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/logs.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/new.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/pull.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/purge.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/push.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/restart.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/shell.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/show.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/up.py (100%) rename {src/kiwi => kiwi_scp}/subcommands/update.py (100%) create mode 100644 setup.py diff --git a/bump-version.sh b/bump-version.sh index a9cd35a..9278bd4 100755 --- a/bump-version.sh +++ b/bump-version.sh @@ -4,7 +4,9 @@ this="$(readlink -f "${0}")" this_dir="$(dirname "${this}")" git_branch="$(git rev-parse --abbrev-ref HEAD)" +git_tag="$(git describe --abbrev=0)" version_str="${git_branch##*/}" echo "${version_str}" > "${this_dir}/src/etc/version_tag" sed -ri "s/(version\s*:).*$/\1 '${version_str}'/" "${this_dir}/example/kiwi.yml" +sed -ri "s/(version\s*=\s*).*$/\1\"${version_str}\",/" "${this_dir}/setup.py" diff --git a/src/etc/command_help.txt b/data/etc/command_help.txt similarity index 100% rename from src/etc/command_help.txt rename to data/etc/command_help.txt diff --git a/src/etc/docker-compose_default.yml b/data/etc/docker-compose_default.yml similarity index 100% rename from src/etc/docker-compose_default.yml rename to data/etc/docker-compose_default.yml diff --git a/src/etc/kiwi_default.yml b/data/etc/kiwi_default.yml similarity index 100% rename from src/etc/kiwi_default.yml rename to data/etc/kiwi_default.yml diff --git a/src/etc/kiwi_header.yml b/data/etc/kiwi_header.yml similarity index 100% rename from src/etc/kiwi_header.yml rename to data/etc/kiwi_header.yml diff --git a/src/etc/kiwi_help.txt b/data/etc/kiwi_help.txt similarity index 100% rename from src/etc/kiwi_help.txt rename to data/etc/kiwi_help.txt diff --git a/src/etc/version_tag b/data/etc/version_tag similarity index 100% rename from src/etc/version_tag rename to data/etc/version_tag diff --git a/src/images/rsync.Dockerfile b/data/images/rsync.Dockerfile similarity index 100% rename from src/images/rsync.Dockerfile rename to data/images/rsync.Dockerfile diff --git a/src/kiwi/__init__.py b/kiwi_scp/__init__.py similarity index 100% rename from src/kiwi/__init__.py rename to kiwi_scp/__init__.py diff --git a/src/kiwi/_constants.py b/kiwi_scp/_constants.py similarity index 100% rename from src/kiwi/_constants.py rename to kiwi_scp/_constants.py diff --git a/src/kiwi/config.py b/kiwi_scp/config.py similarity index 100% rename from src/kiwi/config.py rename to kiwi_scp/config.py diff --git a/src/kiwi/executable.py b/kiwi_scp/executable.py similarity index 97% rename from src/kiwi/executable.py rename to kiwi_scp/executable.py index 3d79983..1c054f5 100644 --- a/src/kiwi/executable.py +++ b/kiwi_scp/executable.py @@ -3,9 +3,6 @@ import logging import os import subprocess -# local -from .config import LoadedConfig - def _is_executable(filename): if filename is None: diff --git a/src/kiwi/misc.py b/kiwi_scp/misc.py similarity index 100% rename from src/kiwi/misc.py rename to kiwi_scp/misc.py diff --git a/src/kiwi/parser.py b/kiwi_scp/parser.py similarity index 100% rename from src/kiwi/parser.py rename to kiwi_scp/parser.py diff --git a/src/kiwi/project.py b/kiwi_scp/project.py similarity index 100% rename from src/kiwi/project.py rename to kiwi_scp/project.py diff --git a/src/kiwi/projects.py b/kiwi_scp/projects.py similarity index 98% rename from src/kiwi/projects.py rename to kiwi_scp/projects.py index 620fc81..1444646 100644 --- a/src/kiwi/projects.py +++ b/kiwi_scp/projects.py @@ -1,6 +1,6 @@ import os -from kiwi.project import Project +from .project import Project class Projects: diff --git a/src/kiwi/rootkit.py b/kiwi_scp/rootkit.py similarity index 100% rename from src/kiwi/rootkit.py rename to kiwi_scp/rootkit.py diff --git a/src/kiwi/runner.py b/kiwi_scp/runner.py similarity index 100% rename from src/kiwi/runner.py rename to kiwi_scp/runner.py diff --git a/kiwi_scp/scripts/__init__.py b/kiwi_scp/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/kiwi-scp.py b/kiwi_scp/scripts/kiwi.py similarity index 88% rename from src/kiwi-scp.py rename to kiwi_scp/scripts/kiwi.py index 7435727..9bcbc20 100755 --- a/src/kiwi-scp.py +++ b/kiwi_scp/scripts/kiwi.py @@ -4,7 +4,7 @@ import logging # local -import kiwi +import kiwi_scp def set_verbosity(logger, handler, verbosity): @@ -28,10 +28,10 @@ def main(): # add a new handler (needed to set the level) log_handler = logging.StreamHandler() logging.getLogger().addHandler(log_handler) - set_verbosity(logging.getLogger(), log_handler, kiwi.verbosity()) + set_verbosity(logging.getLogger(), log_handler, kiwi_scp.verbosity()) # run the app - if not kiwi.run(): + if not kiwi_scp.run(): quit(1) diff --git a/src/kiwi/subcommand.py b/kiwi_scp/subcommand.py similarity index 100% rename from src/kiwi/subcommand.py rename to kiwi_scp/subcommand.py diff --git a/src/kiwi/subcommands/__init__.py b/kiwi_scp/subcommands/__init__.py similarity index 100% rename from src/kiwi/subcommands/__init__.py rename to kiwi_scp/subcommands/__init__.py diff --git a/src/kiwi/subcommands/_hidden.py b/kiwi_scp/subcommands/_hidden.py similarity index 98% rename from src/kiwi/subcommands/_hidden.py rename to kiwi_scp/subcommands/_hidden.py index d3e0901..062495b 100644 --- a/src/kiwi/subcommands/_hidden.py +++ b/kiwi_scp/subcommands/_hidden.py @@ -3,7 +3,6 @@ import logging import subprocess # local -from .._constants import CONF_DIRECTORY_NAME from ..config import LoadedConfig from ..executable import Executable from ..projects import Projects diff --git a/src/kiwi/subcommands/build.py b/kiwi_scp/subcommands/build.py similarity index 100% rename from src/kiwi/subcommands/build.py rename to kiwi_scp/subcommands/build.py diff --git a/src/kiwi/subcommands/cmd.py b/kiwi_scp/subcommands/cmd.py similarity index 100% rename from src/kiwi/subcommands/cmd.py rename to kiwi_scp/subcommands/cmd.py diff --git a/src/kiwi/subcommands/disable.py b/kiwi_scp/subcommands/disable.py similarity index 100% rename from src/kiwi/subcommands/disable.py rename to kiwi_scp/subcommands/disable.py diff --git a/src/kiwi/subcommands/down.py b/kiwi_scp/subcommands/down.py similarity index 100% rename from src/kiwi/subcommands/down.py rename to kiwi_scp/subcommands/down.py diff --git a/src/kiwi/subcommands/enable.py b/kiwi_scp/subcommands/enable.py similarity index 100% rename from src/kiwi/subcommands/enable.py rename to kiwi_scp/subcommands/enable.py diff --git a/src/kiwi/subcommands/init.py b/kiwi_scp/subcommands/init.py similarity index 100% rename from src/kiwi/subcommands/init.py rename to kiwi_scp/subcommands/init.py diff --git a/src/kiwi/subcommands/logs.py b/kiwi_scp/subcommands/logs.py similarity index 100% rename from src/kiwi/subcommands/logs.py rename to kiwi_scp/subcommands/logs.py diff --git a/src/kiwi/subcommands/new.py b/kiwi_scp/subcommands/new.py similarity index 100% rename from src/kiwi/subcommands/new.py rename to kiwi_scp/subcommands/new.py diff --git a/src/kiwi/subcommands/pull.py b/kiwi_scp/subcommands/pull.py similarity index 100% rename from src/kiwi/subcommands/pull.py rename to kiwi_scp/subcommands/pull.py diff --git a/src/kiwi/subcommands/purge.py b/kiwi_scp/subcommands/purge.py similarity index 100% rename from src/kiwi/subcommands/purge.py rename to kiwi_scp/subcommands/purge.py diff --git a/src/kiwi/subcommands/push.py b/kiwi_scp/subcommands/push.py similarity index 100% rename from src/kiwi/subcommands/push.py rename to kiwi_scp/subcommands/push.py diff --git a/src/kiwi/subcommands/restart.py b/kiwi_scp/subcommands/restart.py similarity index 100% rename from src/kiwi/subcommands/restart.py rename to kiwi_scp/subcommands/restart.py diff --git a/src/kiwi/subcommands/shell.py b/kiwi_scp/subcommands/shell.py similarity index 100% rename from src/kiwi/subcommands/shell.py rename to kiwi_scp/subcommands/shell.py diff --git a/src/kiwi/subcommands/show.py b/kiwi_scp/subcommands/show.py similarity index 100% rename from src/kiwi/subcommands/show.py rename to kiwi_scp/subcommands/show.py diff --git a/src/kiwi/subcommands/up.py b/kiwi_scp/subcommands/up.py similarity index 100% rename from src/kiwi/subcommands/up.py rename to kiwi_scp/subcommands/up.py diff --git a/src/kiwi/subcommands/update.py b/kiwi_scp/subcommands/update.py similarity index 100% rename from src/kiwi/subcommands/update.py rename to kiwi_scp/subcommands/update.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..ee07190 --- /dev/null +++ b/setup.py @@ -0,0 +1,23 @@ +from setuptools import setup, find_packages + +setup( + name="kiwi_scp", + version="0.1.6", + packages=find_packages(), + author="LDericher", + author_email="ldericher@gmx.de", + setup_requires="setuptools-pipfile", + use_pipfile=True, + entry_points={ + "console_scripts": [ + "kiwi = kiwi_scp.scripts.kiwi:main" + ], + }, + data_files=[ + ("", ["data/etc/kiwi_help.txt"]) + ], + include_package_data=True, + license="LICENSE", + description="kiwi is the simple tool for managing container servers.", + long_description=open("README.md").read(), +) From 4f29c8107ed8d0efae29a8b42531fa1d792bae09 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Tue, 28 Sep 2021 13:23:15 +0200 Subject: [PATCH 2/7] Pipenv => Poetry --- .idea/kiwi-scp.iml | 2 +- .idea/misc.xml | 2 +- Pipfile | 12 ---- Pipfile.lock | 56 ------------------- bump-version.sh | 5 +- {data => kiwi_scp/data}/etc/command_help.txt | 0 .../data}/etc/docker-compose_default.yml | 0 {data => kiwi_scp/data}/etc/kiwi_default.yml | 0 {data => kiwi_scp/data}/etc/kiwi_header.yml | 0 {data => kiwi_scp/data}/etc/kiwi_help.txt | 0 {data => kiwi_scp/data}/etc/version_tag | 0 .../data}/images/rsync.Dockerfile | 0 poetry.lock | 45 +++++++++++++++ pyproject.toml | 18 ++++++ setup.py | 16 ++++-- 15 files changed, 80 insertions(+), 76 deletions(-) delete mode 100644 Pipfile delete mode 100644 Pipfile.lock rename {data => kiwi_scp/data}/etc/command_help.txt (100%) rename {data => kiwi_scp/data}/etc/docker-compose_default.yml (100%) rename {data => kiwi_scp/data}/etc/kiwi_default.yml (100%) rename {data => kiwi_scp/data}/etc/kiwi_header.yml (100%) rename {data => kiwi_scp/data}/etc/kiwi_help.txt (100%) rename {data => kiwi_scp/data}/etc/version_tag (100%) rename {data => kiwi_scp/data}/images/rsync.Dockerfile (100%) create mode 100644 poetry.lock create mode 100644 pyproject.toml diff --git a/.idea/kiwi-scp.iml b/.idea/kiwi-scp.iml index a74c05f..127e464 100644 --- a/.idea/kiwi-scp.iml +++ b/.idea/kiwi-scp.iml @@ -5,7 +5,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index bd89605..174826d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 38477a7..0000000 --- a/Pipfile +++ /dev/null @@ -1,12 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] - -[packages] -pyyaml = "*" - -[requires] -python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index 30dd482..0000000 --- a/Pipfile.lock +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "d518a36ed441568acff15b0a3c4b536738a55fb68801cdd682045be04d29954a" - }, - "pipfile-spec": 6, - "requires": { - "python_version": "3.6" - }, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": { - "pyyaml": { - "hashes": [ - "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf", - "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696", - "sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393", - "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77", - "sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922", - "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5", - "sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8", - "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10", - "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc", - "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018", - "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e", - "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253", - "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347", - "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183", - "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541", - "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb", - "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185", - "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc", - "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db", - "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa", - "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46", - "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122", - "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b", - "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63", - "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df", - "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc", - "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247", - "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6", - "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0" - ], - "index": "pypi", - "version": "==5.4.1" - } - }, - "develop": {} -} diff --git a/bump-version.sh b/bump-version.sh index 9278bd4..c313d4c 100755 --- a/bump-version.sh +++ b/bump-version.sh @@ -6,7 +6,8 @@ this_dir="$(dirname "${this}")" git_branch="$(git rev-parse --abbrev-ref HEAD)" git_tag="$(git describe --abbrev=0)" version_str="${git_branch##*/}" +version_str="0.1.6" -echo "${version_str}" > "${this_dir}/src/etc/version_tag" +echo "${version_str}" > "${this_dir}/kiwi_scp/data/etc/version_tag" sed -ri "s/(version\s*:).*$/\1 '${version_str}'/" "${this_dir}/example/kiwi.yml" -sed -ri "s/(version\s*=\s*).*$/\1\"${version_str}\",/" "${this_dir}/setup.py" +sed -ri "s/(version\s*=\s*).*$/\1\"${version_str}\"/" "${this_dir}/pyproject.toml" diff --git a/data/etc/command_help.txt b/kiwi_scp/data/etc/command_help.txt similarity index 100% rename from data/etc/command_help.txt rename to kiwi_scp/data/etc/command_help.txt diff --git a/data/etc/docker-compose_default.yml b/kiwi_scp/data/etc/docker-compose_default.yml similarity index 100% rename from data/etc/docker-compose_default.yml rename to kiwi_scp/data/etc/docker-compose_default.yml diff --git a/data/etc/kiwi_default.yml b/kiwi_scp/data/etc/kiwi_default.yml similarity index 100% rename from data/etc/kiwi_default.yml rename to kiwi_scp/data/etc/kiwi_default.yml diff --git a/data/etc/kiwi_header.yml b/kiwi_scp/data/etc/kiwi_header.yml similarity index 100% rename from data/etc/kiwi_header.yml rename to kiwi_scp/data/etc/kiwi_header.yml diff --git a/data/etc/kiwi_help.txt b/kiwi_scp/data/etc/kiwi_help.txt similarity index 100% rename from data/etc/kiwi_help.txt rename to kiwi_scp/data/etc/kiwi_help.txt diff --git a/data/etc/version_tag b/kiwi_scp/data/etc/version_tag similarity index 100% rename from data/etc/version_tag rename to kiwi_scp/data/etc/version_tag diff --git a/data/images/rsync.Dockerfile b/kiwi_scp/data/images/rsync.Dockerfile similarity index 100% rename from data/images/rsync.Dockerfile rename to kiwi_scp/data/images/rsync.Dockerfile diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..dd53b7f --- /dev/null +++ b/poetry.lock @@ -0,0 +1,45 @@ +[[package]] +name = "pyyaml" +version = "5.4.1" +description = "YAML parser and emitter for Python" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" + +[metadata] +lock-version = "1.1" +python-versions = "^3.6" +content-hash = "36970da0e8c6151dcf68abd9008ecef35673f04db53952bfb3fd7544c0516b7f" + +[metadata.files] +pyyaml = [ + {file = "PyYAML-5.4.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922"}, + {file = "PyYAML-5.4.1-cp27-cp27m-win32.whl", hash = "sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393"}, + {file = "PyYAML-5.4.1-cp27-cp27m-win_amd64.whl", hash = "sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8"}, + {file = "PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185"}, + {file = "PyYAML-5.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_s390x.whl", hash = "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541"}, + {file = "PyYAML-5.4.1-cp36-cp36m-win32.whl", hash = "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5"}, + {file = "PyYAML-5.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df"}, + {file = "PyYAML-5.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_s390x.whl", hash = "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"}, + {file = "PyYAML-5.4.1-cp37-cp37m-win32.whl", hash = "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b"}, + {file = "PyYAML-5.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf"}, + {file = "PyYAML-5.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_s390x.whl", hash = "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc"}, + {file = "PyYAML-5.4.1-cp38-cp38-win32.whl", hash = "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc"}, + {file = "PyYAML-5.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696"}, + {file = "PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_s390x.whl", hash = "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6"}, + {file = "PyYAML-5.4.1-cp39-cp39-win32.whl", hash = "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10"}, + {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, + {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b134696 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "kiwi-scp" +version = "0.1.6" +description = "kiwi is the simple tool for managing container servers." +authors = ["ldericher <40151420+ldericher@users.noreply.github.com>"] + +[tool.poetry.dependencies] +python = "^3.6" +PyYAML = "^5.4.1" + +[tool.poetry.dev-dependencies] + +[tool.poetry.scripts] +kiwi = "kiwi_scp.scripts.kiwi:main" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/setup.py b/setup.py index ee07190..a3f96d2 100644 --- a/setup.py +++ b/setup.py @@ -3,21 +3,29 @@ from setuptools import setup, find_packages setup( name="kiwi_scp", version="0.1.6", + description="kiwi is the simple tool for managing container servers.", + long_description=open("README.md").read(), packages=find_packages(), + license="LICENSE", + author="LDericher", author_email="ldericher@gmx.de", + setup_requires="setuptools-pipfile", use_pipfile=True, + entry_points={ "console_scripts": [ "kiwi = kiwi_scp.scripts.kiwi:main" ], }, data_files=[ - ("", ["data/etc/kiwi_help.txt"]) + ('./kiwi_scp/', [ + "*.txt", + "*.yml", + "*.Dockerfile", + "data/etc/version_tag", + ]) ], include_package_data=True, - license="LICENSE", - description="kiwi is the simple tool for managing container servers.", - long_description=open("README.md").read(), ) From 49e3b504fc279589ef4e6559b020ec49bc8c8848 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Tue, 28 Sep 2021 19:43:12 +0200 Subject: [PATCH 3/7] bandaid fix for KIWI_ROOT --- kiwi_scp/_constants.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kiwi_scp/_constants.py b/kiwi_scp/_constants.py index be0ab6d..cd12c09 100644 --- a/kiwi_scp/_constants.py +++ b/kiwi_scp/_constants.py @@ -4,8 +4,8 @@ import os ############# # ENVIRONMENT -# location of "src" directory to use -KIWI_ROOT = os.getenv('KIWI_ROOT', ".") +# location of "kiwi_scp" module +KIWI_ROOT = os.path.dirname(__file__) # default name of kiwi-scp file KIWI_CONF_NAME = os.getenv('KIWI_CONF_NAME', "kiwi.yml") @@ -13,17 +13,17 @@ KIWI_CONF_NAME = os.getenv('KIWI_CONF_NAME', "kiwi.yml") # FILE NAMES # text files inside kiwi-scp "src" directory -HEADER_KIWI_CONF_NAME = f"{KIWI_ROOT}/etc/kiwi_header.yml" -DEFAULT_KIWI_CONF_NAME = f"{KIWI_ROOT}/etc/kiwi_default.yml" -VERSION_TAG_NAME = f"{KIWI_ROOT}/etc/version_tag" -DEFAULT_DOCKER_COMPOSE_NAME = f"{KIWI_ROOT}/etc/docker-compose_default.yml" -KIWI_HELP_TEXT_NAME = f"{KIWI_ROOT}/etc/kiwi_help.txt" -COMMAND_HELP_TEXT_NAME = f"{KIWI_ROOT}/etc/command_help.txt" +HEADER_KIWI_CONF_NAME = f"{KIWI_ROOT}/data/etc/kiwi_header.yml" +DEFAULT_KIWI_CONF_NAME = f"{KIWI_ROOT}/data/etc/kiwi_default.yml" +VERSION_TAG_NAME = f"{KIWI_ROOT}/data/etc/version_tag" +DEFAULT_DOCKER_COMPOSE_NAME = f"{KIWI_ROOT}/data/etc/docker-compose_default.yml" +KIWI_HELP_TEXT_NAME = f"{KIWI_ROOT}/data/etc/kiwi_help.txt" +COMMAND_HELP_TEXT_NAME = f"{KIWI_ROOT}/data/etc/command_help.txt" # special config directory in projects CONF_DIRECTORY_NAME = 'conf' # location for auxiliary Dockerfiles -IMAGES_DIRECTORY_NAME = f"{KIWI_ROOT}/images" +IMAGES_DIRECTORY_NAME = f"{KIWI_ROOT}/data/images" #################### # DOCKER IMAGE NAMES From d7a955b68ae4188738630ca4fafc884cfb498a6c Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Tue, 28 Sep 2021 19:54:22 +0200 Subject: [PATCH 4/7] Docker + CI --- .drone.yml | 16 ++++++++++++++++ Dockerfile | 17 +++++++++++++++++ README.md | 2 ++ 3 files changed, 35 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..b19a823 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,16 @@ +--- +kind: pipeline +name: default + +steps: +- name: docker + image: plugins/docker + settings: + repo: ldericher/kind + # auto_tag: true + tags: + - latest + username: + from_secret: DOCKER_USERNAME + password: + from_secret: DOCKER_PASSWORD \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dd4db5d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3.6-alpine3.13 + +ENV PYTHONUNBUFFERED 1 + +RUN set -ex; \ + # install prerequisites + apk add --no-cache \ + docker-cli \ + docker-compose \ + ; + +COPY . /usr/src/kiwi_scp + +RUN set -ex; \ + pip3 --use-feature=in-tree-build install /usr/src/kiwi_scp + +ENTRYPOINT ["kiwi"] diff --git a/README.md b/README.md index e087f50..9d6de66 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # kiwi-scp +[![Build Status](https://github.drone.yavook.de/api/badges/ldericher/kiwi-scp/status.svg)](https://github.drone.yavook.de/ldericher/kiwi-scp) + > `kiwi` - simple, consistent, powerful The simple tool for managing container servers From b38145e3cd1a77363327bd067786280f8f7eb975 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Tue, 28 Sep 2021 23:00:30 +0200 Subject: [PATCH 5/7] CI + typo --- .drone.yml | 3 ++- kiwi_scp/data/etc/docker-compose_default.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index b19a823..4cd5351 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,7 +9,8 @@ steps: repo: ldericher/kind # auto_tag: true tags: - - latest + - edge + purge: false username: from_secret: DOCKER_USERNAME password: diff --git a/kiwi_scp/data/etc/docker-compose_default.yml b/kiwi_scp/data/etc/docker-compose_default.yml index 47f85e4..d3cbd6d 100644 --- a/kiwi_scp/data/etc/docker-compose_default.yml +++ b/kiwi_scp/data/etc/docker-compose_default.yml @@ -4,7 +4,7 @@ networks: # reachable from outside default: driver: bridge - # interconnects projects + # interconnect projects kiwi_hub: external: name: ${KIWI_HUB_NAME} From 9cdd41927df1fa10470ddb3e964e61cf36c2ba75 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Thu, 30 Sep 2021 16:49:12 +0200 Subject: [PATCH 6/7] remove pipenv dependency --- kiwi | 68 +++++++++++++++++------------------------------------------- 1 file changed, 19 insertions(+), 49 deletions(-) diff --git a/kiwi b/kiwi index ff64118..4038eb4 100755 --- a/kiwi +++ b/kiwi @@ -7,10 +7,10 @@ # base config filename KIWI_CONF_NAME="kiwi.yml" # version tag filename -KIWI_VERSION_TAG="etc/version_tag" +KIWI_VERSION_TAG="kiwi_scp/data/etc/version_tag" # dependencies to run kiwi-scp -KIWI_DEPENDENCIES="python3 pipenv less docker docker-compose" +KIWI_DEPENDENCIES="python3 less docker docker-compose" # base install dir KIWI_BASEDIR="${HOME}/.cache/kiwi-scp" # per-user env setup script @@ -32,12 +32,9 @@ CANARY_MAX_AGE=600 # DYNAMIC STRINGS # ################### -# cache current work directory -WORKDIR="$(pwd)" - # uri of correct kiwi-scp archive kiwi_archive_uri() { - echo "${KIWI_REPO}/archive/${KIWI_VERSION}.tar.gz" + echo "${KIWI_REPO}/archive/refs/heads/${KIWI_VERSION}.tar.gz" } # directory of correct installation @@ -45,14 +42,9 @@ kiwi_install_dir() { echo "${KIWI_BASEDIR}/${KIWI_VERSION}" } -# src directory in installed version -kiwi_root() { - echo "$(kiwi_install_dir)/src" -} - # main script in installed version kiwi_executable() { - echo "$(kiwi_root)/kiwi-scp.py" + echo "$(kiwi_install_dir)/bin/kiwi" } ############# @@ -175,54 +167,32 @@ fi if [ ! -x "$(kiwi_executable)" ]; then printf "Installing kiwi-scp v%s into %s ... " "${KIWI_VERSION}" "${KIWI_BASEDIR}" - # switch to temp dir - tmp_dir=$(mktemp -d) - cd "${tmp_dir}" || : - - # download archive - curl --proto '=https' --tlsv1.2 -sSfL "$(kiwi_archive_uri)" | tar xz - - # read archive version tag - cd "kiwi-scp-${KIWI_VERSION}" || : - KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}") + # read version tag + KIWI_VERSION="$( \ + curl \ + --proto '=https' \ + --tlsv1.2 \ + -sSfL \ + "https://raw.githubusercontent.com/ldericher/kiwi-scp/${KIWI_VERSION}/${KIWI_VERSION_TAG}" \ + )" if [ -x "$(kiwi_executable)" ]; then - # after version update: no need to install + # after version tag update: no need to install echo "v${KIWI_VERSION} already installed!" else # install archive - mkdir -p "$(kiwi_install_dir)" - mv "src" "Pipfile" "Pipfile.lock" "$(kiwi_install_dir)/" + python3 -m virtualenv "$(kiwi_install_dir)" >/dev/null 2>/dev/null + . "$(kiwi_install_dir)/bin/activate" + python3 -m pip install "git+${KIWI_REPO}@${KIWI_VERSION}" >/dev/null 2>/dev/null + echo "OK" fi - - # discard temp dir - cd "${WORKDIR}" || : - rm -rf "${tmp_dir}" fi # setup main environment -KIWI_ROOT="$(kiwi_root)" -PIPENV_VERBOSITY=-1 -PIPENV_PIPFILE="$(kiwi_install_dir)/Pipfile" - export KIWI_CONF_NAME -export KIWI_ROOT -export PIPENV_VERBOSITY -export PIPENV_PIPFILE - -# check virtualenv -cd "$(kiwi_install_dir)" || : -if ! pipenv --venv >/dev/null 2>/dev/null; then - # install virtualenv - printf "Preparing virtualenv ... " - pipenv sync >/dev/null 2>/dev/null - echo "OK" -fi - -# go back to the original work directory -cd "${WORKDIR}" || : +. "$(kiwi_install_dir)/bin/activate" # run main script -exec pipenv run "$(kiwi_executable)" "${@}" +exec "$(kiwi_executable)" "${@}" From 4b611d41c5da36fabf7a5ad38a7447065c7929f1 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Thu, 30 Sep 2021 17:49:22 +0200 Subject: [PATCH 7/7] docker tag --- .drone.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4cd5351..ecd6889 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,10 +7,9 @@ steps: image: plugins/docker settings: repo: ldericher/kind - # auto_tag: true - tags: - - edge - purge: false + auto_tag: true +# tags: +# - edge username: from_secret: DOCKER_USERNAME password: