Compare commits
4 Commits
main
...
c1f9cb996b
Author | SHA1 | Date | |
---|---|---|---|
c1f9cb996b | |||
5e8e80680d | |||
8239c889c9 | |||
c7514a433c |
13
.drone.yml
13
.drone.yml
@ -5,18 +5,17 @@ name: build and publish
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: registry.kucharczyk.tech/python-pypi
|
image: python
|
||||||
commands:
|
commands:
|
||||||
- python -m build
|
- python -m build
|
||||||
- name: publish
|
- name: publish
|
||||||
image: registry.kucharczyk.tech/python-pypi
|
image: plugins/pypi
|
||||||
commands:
|
settings:
|
||||||
- python -m twine upload -u $USERNAME -p $PASSWORD dist/*
|
username:
|
||||||
environment:
|
|
||||||
USERNAME:
|
|
||||||
from_secret: pypi_username
|
from_secret: pypi_username
|
||||||
PASSWORD:
|
password:
|
||||||
from_secret: pypi_password
|
from_secret: pypi_password
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = false
|
|
||||||
charset = utf-8
|
|
||||||
|
|
||||||
[*.py]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[Makefile]
|
|
||||||
indent_size = tab
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,3 @@
|
|||||||
.vscode
|
.vscode
|
||||||
dist
|
dist
|
||||||
src/*.egg-info
|
src/*.egg-info
|
||||||
__pycache__
|
|
||||||
.pytest_cache
|
|
7
Makefile
7
Makefile
@ -1,7 +0,0 @@
|
|||||||
init:
|
|
||||||
pip install -r requirements.txt
|
|
||||||
|
|
||||||
test:
|
|
||||||
py.test tests
|
|
||||||
|
|
||||||
.PHONY: init test
|
|
@ -1,29 +0,0 @@
|
|||||||
"""
|
|
||||||
Manga checker and downloader
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
description="Check for manga updates and download them."
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
'-d', '--destination', type=str, required=True, help="Target destination where the download file should be saved."
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
'-s', '--chapter-start', type=int, default=1, help="From which chapter should the program check."
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
'-n', '--notify', type=str, default=None, help="Apprise notification string."
|
|
||||||
)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
destination = os.path.abspath(args.destination)
|
|
||||||
|
|
||||||
if not os.path.exists(destination):
|
|
||||||
print(f'Destination {destination} does not exist.')
|
|
||||||
if not os.path.isdir(destination):
|
|
||||||
print(f'Destination {destination} is not a directory.')
|
|
@ -6,6 +6,7 @@ author_email = lukas@kucharczyk.xyz
|
|||||||
description = A simple manga update checker and downloader
|
description = A simple manga update checker and downloader
|
||||||
long_description = file: README.md
|
long_description = file: README.md
|
||||||
long_description_content_type = text/markdown
|
long_description_content_type = text/markdown
|
||||||
|
license = GPLv3+
|
||||||
url = https://git.kucharczyk.xyz/lukas/manga-up
|
url = https://git.kucharczyk.xyz/lukas/manga-up
|
||||||
project_urls =
|
project_urls =
|
||||||
Bug Tracker = https://git.kucharczyk.xyz/lukas/manga-up/issues
|
Bug Tracker = https://git.kucharczyk.xyz/lukas/manga-up/issues
|
||||||
|
4
src/manga-up/manga-up.py
Normal file
4
src/manga-up/manga-up.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
response = requests.get('https://httpbin.org/ip')
|
||||||
|
print('Code is {0}.'.format(response.status_code))
|
@ -1,29 +0,0 @@
|
|||||||
from subprocess import CalledProcessError
|
|
||||||
import unittest
|
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class ArgumentTestClass(unittest.TestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
import tempfile
|
|
||||||
self.existing_dir = tempfile.mkdtemp()
|
|
||||||
|
|
||||||
def test_argument_required(self):
|
|
||||||
with self.assertRaises(CalledProcessError):
|
|
||||||
subprocess.check_output(['python', 'manga_up'])
|
|
||||||
|
|
||||||
def test_destination_exists(self):
|
|
||||||
result = subprocess.check_output(['python', 'manga_up', '--destination', 'nonexistent'])
|
|
||||||
self.assertIn('does not exist', str(result))
|
|
||||||
|
|
||||||
def test_destination_is_not_directory(self):
|
|
||||||
result = subprocess.check_output(['python', 'manga_up', '--destination', self.existing_file])
|
|
||||||
self.assertIn('not a directory', str(result))
|
|
||||||
|
|
||||||
def tearDown(self) -> None:
|
|
||||||
os.rmdir(self.existing_dir)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
Reference in New Issue
Block a user