fix: Properly define script

pull/6/head
Raphaël Vinot 2020-03-10 15:15:41 +01:00
parent 45752051d8
commit db53b5e89b
3 changed files with 21 additions and 23 deletions

View File

@ -1,22 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from pytaxonomies import Taxonomies
def main():
argParser = argparse.ArgumentParser(description='Use MISP taxonomies')
argParser.add_argument('-a', '--all', action='store_true', help='Print all taxonomies as machine tags')
argParser.add_argument('-l', '--local', default=None, help='Use local manifest file.')
args = argParser.parse_args()
if args.local:
t = Taxonomies(manifest_path=args.local)
else:
t = Taxonomies()
if args.all:
print(t)
from pytaxonomies.script import main
if __name__ == '__main__':
main()

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pytaxonomies"
version = "1.0"
version = "1.1"
description = "Python API for the taxonomies."
authors = ["Raphaël Vinot <raphael.vinot@circl.lu>"]
license = "BSD-3-Clause"
@ -23,11 +23,6 @@ include = ["pytaxonomies/data/misp-taxonomies/schema.json",
"pytaxonomies/data/misp-taxonomies/MANIFEST.json",
"pytaxonomies/data/misp-taxonomies/*/machinetag.json"]
packages = [
{ include = "pytaxonomies" },
{ include = "pytaxonomies", from="bin" }
]
[tool.poetry.dependencies]
python = "^3.6"
requests = { version = "^2.22.0", optional = true }
@ -48,7 +43,7 @@ nose = "^1.3.7"
mypy = "^0.761"
[tool.poetry.scripts]
pytaxonomies = 'bin.pytaxonomies:main'
pytaxonomies = 'pytaxonomies.script:main'
[build-system]
requires = ["poetry>=0.12"]

18
pytaxonomies/script.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
from pytaxonomies import Taxonomies
def main():
argParser = argparse.ArgumentParser(description='Use MISP taxonomies')
argParser.add_argument('-a', '--all', action='store_true', help='Print all taxonomies as machine tags')
argParser.add_argument('-l', '--local', default=None, help='Use local manifest file.')
args = argParser.parse_args()
if args.local:
t = Taxonomies(manifest_path=args.local)
else:
t = Taxonomies()
if args.all:
print(t)