From 64b3b72cb82c343d40cf394db662f22b80bfd073 Mon Sep 17 00:00:00 2001 From: automationator Date: Thu, 30 Aug 2018 14:11:11 -0400 Subject: [PATCH 1/2] Version 0.2.0: Adds a command-line script to find urls --- README.md => README | 0 bin/urlfinder | 20 ++++++++++++++++++++ setup.py | 7 +++++-- 3 files changed, 25 insertions(+), 2 deletions(-) rename README.md => README (100%) create mode 100755 bin/urlfinder diff --git a/README.md b/README similarity index 100% rename from README.md rename to README diff --git a/bin/urlfinder b/bin/urlfinder new file mode 100755 index 0000000..6e7056d --- /dev/null +++ b/bin/urlfinder @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import urlfinderlib +import sys + +if __name__ == '__main__': + try: + file_path = sys.argv[1] + except: + print('Usage: urlfinder /path/to/file') + sys.exit(1) + + try: + with open(file_path, 'rb') as f: + urls = sorted(list(set(urlfinderlib.find_urls(f.read())))) + for url in urls: + print(url) + except: + print('Usage: urlfinder /path/to/file') + sys.exit(1) diff --git a/setup.py b/setup.py index e56cfb0..25892af 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ here = path.abspath(path.dirname(__file__)) # Get the long description from the README file -with open(path.join(here, 'README.md'), encoding='utf-8') as f: +with open(path.join(here, 'README'), encoding='utf-8') as f: long_description = f.read() setup( @@ -23,10 +23,11 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='0.1.2', + version='0.2.0', description='Library to find URLs and check their validity.', long_description=long_description, + long_description_content_type='text/markdown', # The project's main homepage. url='https://github.com/IntegralDefense/urlfinderlib', @@ -94,6 +95,8 @@ #'sample': ['package_data.dat'], }, + scripts=['bin/urlfinder'], + # Although 'package_data' is the preferred approach, in some case you may # need to place data files outside of your packages. See: # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa From fa6562c9cd17afa11abd58279abaeb0a7f112f67 Mon Sep 17 00:00:00 2001 From: automationator Date: Thu, 30 Aug 2018 14:14:32 -0400 Subject: [PATCH 2/2] Fixes README.md inclusion --- MANIFEST.in | 1 + README => README.md | 0 setup.py | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 MANIFEST.in rename README => README.md (100%) diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..bb3ec5f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include README.md diff --git a/README b/README.md similarity index 100% rename from README rename to README.md diff --git a/setup.py b/setup.py index 25892af..b533288 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ here = path.abspath(path.dirname(__file__)) # Get the long description from the README file -with open(path.join(here, 'README'), encoding='utf-8') as f: +with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup(