From edf737324c2f94f3fd5b9bc1b58bed0deb1857e2 Mon Sep 17 00:00:00 2001 From: Yuki NAKAMURA Date: Tue, 26 Oct 2021 18:14:17 +0900 Subject: [PATCH] utilize consoleoptions --- MANIFEST.in | 1 + requirements.txt | 4 ++++ setup.py | 8 +++++++- src/option/__init__.py | 1 - src/option/get_option.py | 24 ------------------------ src/yknsshanalysis.py | 11 +---------- 6 files changed, 13 insertions(+), 36 deletions(-) create mode 100644 MANIFEST.in create mode 100644 requirements.txt delete mode 100644 src/option/__init__.py delete mode 100644 src/option/get_option.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..540b720 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include requirements.txt \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2550820 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +pandas +consoleoptions +circlify +matplotlib \ No newline at end of file diff --git a/setup.py b/setup.py index c367489..ef80734 100644 --- a/setup.py +++ b/setup.py @@ -2,9 +2,14 @@ with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() + +def _requires_from_file(filename): + return open(filename).read().splitlines() + + setuptools.setup( name="yknsshanalysis", - version="1.2.0", + version="1.3.0", author="Yuki NAKAMURA", author_email="naka_yk@live.jp", description="Analyze auth.log", @@ -23,6 +28,7 @@ py_modules=['yknsshanalysis'], packages=setuptools.find_packages(where="src"), python_requires=">=3.6", + install_requires=_requires_from_file('requirements.txt'), entry_points={ 'console_scripts': [ 'yknsshanalysis = yknsshanalysis:main' diff --git a/src/option/__init__.py b/src/option/__init__.py deleted file mode 100644 index 6ad2608..0000000 --- a/src/option/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import get_option diff --git a/src/option/get_option.py b/src/option/get_option.py deleted file mode 100644 index f92b82b..0000000 --- a/src/option/get_option.py +++ /dev/null @@ -1,24 +0,0 @@ -# optionName="" もしくはoptionName=''もしくはoptionName=○○もしくはoptionNameで定義された入力オプションを検出して辞書化する - -def trim(string): - if len(string) == 0: - return '' - elif string[0] == '\'' or string[0] == '\"': - return string[1:-1] - else: - return string - - -def get_dict(args, dict={}): - for arg in args: - eqindex = arg.find('=') - if eqindex == -1: - dict[arg] = True - else: - dict[arg[:eqindex]] = trim(arg[eqindex + 1:]) - return dict - - -def to_int(dictionary, optionName): - if type(dictionary[optionName]) is not int: - dictionary[optionName] = int(dictionary[optionName]) diff --git a/src/yknsshanalysis.py b/src/yknsshanalysis.py index a46a0fd..1a39cc0 100644 --- a/src/yknsshanalysis.py +++ b/src/yknsshanalysis.py @@ -6,20 +6,11 @@ import circlify import matplotlib.pyplot as plt import pickle -from option import get_option as get_option +import consoleoptions as get_option whois_list = ["http://ipinfo.io/xxx", "http://ipwhois.app/json/xxx", "https://ipapi.co/xxx/json"] -def _trim(string): - if len(string) == 0: - return '' - elif string[0] == '\'' or string[0] == '\"': - return string[1:-1] - else: - return string - - def main(args=sys.argv): # オプションの初期値を設定 optionDict = {}