From 530316cb914fc85a827defe38bf81de07777b373 Mon Sep 17 00:00:00 2001 From: ricterz Date: Sun, 10 May 2015 01:11:57 +0800 Subject: [PATCH] setup.py and add command line support --- MANIFEST.in | 2 ++ {hentai => nhentai}/__init__.py | 0 {hentai => nhentai}/cmdline.py | 0 nhentai.py => nhentai/command.py | 12 ++++++------ {hentai => nhentai}/constant.py | 0 {hentai => nhentai}/dojinshi.py | 4 ++-- {hentai => nhentai}/downloader.py | 2 +- {hentai => nhentai}/logger.py | 2 +- {hentai => nhentai}/parser.py | 2 +- setup.py | 6 ++++-- 10 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 MANIFEST.in rename {hentai => nhentai}/__init__.py (100%) rename {hentai => nhentai}/cmdline.py (100%) rename nhentai.py => nhentai/command.py (80%) rename {hentai => nhentai}/constant.py (100%) rename {hentai => nhentai}/dojinshi.py (93%) rename {hentai => nhentai}/downloader.py (98%) rename {hentai => nhentai}/logger.py (99%) rename {hentai => nhentai}/parser.py (98%) diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..3d387c3 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include README.md +include requirements.txt \ No newline at end of file diff --git a/hentai/__init__.py b/nhentai/__init__.py similarity index 100% rename from hentai/__init__.py rename to nhentai/__init__.py diff --git a/hentai/cmdline.py b/nhentai/cmdline.py similarity index 100% rename from hentai/cmdline.py rename to nhentai/cmdline.py diff --git a/nhentai.py b/nhentai/command.py similarity index 80% rename from nhentai.py rename to nhentai/command.py index fd829b9..4614f78 100644 --- a/nhentai.py +++ b/nhentai/command.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python +#!/usr/bin/env python2.7 #coding: utf-8 -from hentai.cmdline import cmd_parser, banner -from hentai.parser import dojinshi_parser, search_parser, print_dojinshi -from hentai.dojinshi import Dojinshi -from hentai.downloader import Downloader -from hentai.logger import logger +from nhentai.cmdline import cmd_parser, banner +from nhentai.parser import dojinshi_parser, search_parser, print_dojinshi +from nhentai.dojinshi import Dojinshi +from nhentai.downloader import Downloader +from nhentai.logger import logger __version__ = '0.1' diff --git a/hentai/constant.py b/nhentai/constant.py similarity index 100% rename from hentai/constant.py rename to nhentai/constant.py diff --git a/hentai/dojinshi.py b/nhentai/dojinshi.py similarity index 93% rename from hentai/dojinshi.py rename to nhentai/dojinshi.py index 56b1c0e..833d75a 100644 --- a/hentai/dojinshi.py +++ b/nhentai/dojinshi.py @@ -1,6 +1,6 @@ import Queue from constant import DETAIL_URL, IMAGE_URL -from hentai.logger import logger +from nhentai.logger import logger class Dojinshi(object): @@ -36,7 +36,7 @@ class Dojinshi(object): if __name__ == '__main__': - test = Dojinshi(name='test hentai dojinshi', id=1) + test = Dojinshi(name='test nhentai dojinshi', id=1) print test test.show() try: diff --git a/hentai/downloader.py b/nhentai/downloader.py similarity index 98% rename from hentai/downloader.py rename to nhentai/downloader.py index 98622b6..9f9272f 100644 --- a/hentai/downloader.py +++ b/nhentai/downloader.py @@ -6,7 +6,7 @@ import threading import Queue import requests from urlparse import urlparse -from hentai.logger import logger +from nhentai.logger import logger # global timeout diff --git a/hentai/logger.py b/nhentai/logger.py similarity index 99% rename from hentai/logger.py rename to nhentai/logger.py index b7684e0..7d62582 100644 --- a/hentai/logger.py +++ b/nhentai/logger.py @@ -146,7 +146,7 @@ logger.setLevel(logging.DEBUG) if __name__ == '__main__': - logger.log(15, 'hentai') + logger.log(15, 'nhentai') logger.info('info') logger.warn('warn') logger.debug('debug') diff --git a/hentai/parser.py b/nhentai/parser.py similarity index 98% rename from hentai/parser.py rename to nhentai/parser.py index 8c021e8..fdd8d3f 100644 --- a/hentai/parser.py +++ b/nhentai/parser.py @@ -3,7 +3,7 @@ import re import requests from bs4 import BeautifulSoup from constant import DETAIL_URL, SEARCH_URL -from hentai.logger import logger +from nhentai.logger import logger def dojinshi_parser(id): diff --git a/setup.py b/setup.py index abc497a..9da606d 100644 --- a/setup.py +++ b/setup.py @@ -14,11 +14,13 @@ setup( description='nhentai.net dojinshis downloader', url='https://github.com/RicterZ/nhentai', include_package_data=True, + zip_safe=False, install_requires=requirements, entry_points={ 'console_scripts': [ - 'nhentai = nhentai:main', + 'nhentai = nhentai.command:main', ] - } + }, + license='MIT', ) \ No newline at end of file -- 2.44.0