From b0d65e50f931b186668fcd8f106e0deecff5ca73 Mon Sep 17 00:00:00 2001 From: Scott Hansen Date: Wed, 6 Oct 2021 11:10:59 -0700 Subject: [PATCH] Update packaging and setup to current best practices --- README.rst => README.md | 46 +++++++++++------------------- setup.py | 20 ++++++++++--- bin/urlscan => urlscan/__main__.py | 0 3 files changed, 33 insertions(+), 33 deletions(-) rename README.rst => README.md (90%) rename bin/urlscan => urlscan/__main__.py (100%) mode change 100755 => 100644 diff --git a/README.rst b/README.md similarity index 90% rename from README.rst rename to README.md index 9c41cef..299be0a 100644 --- a/README.rst +++ b/README.md @@ -1,17 +1,14 @@ -Urlscan -======= +# Urlscan -Contributors ------------- +## Contributors -Scott Hansen (Author and Maintainer) +Scott Hansen \ (Author and Maintainer) -Maxime Chatelle (Debian Maintainer) +Maxime Chatelle \ (Debian Maintainer) -Daniel Burrows (Original Author) +Daniel Burrows \ (Original Author) -Purpose and Requirements ------------------------- +## Purpose and Requirements Urlscan is a small program that is designed to integrate with the "mutt" mailreader to allow you to easily launch a Web browser for URLs contained in @@ -21,8 +18,7 @@ email messages. It is a replacement for the "urlview" program. Requires: Python 3.6+ and the python-urwid library -Features --------- +## Features Urlscan parses an email message or file and scans it for URLs and email addresses. It then displays the URLs and their context within the message, and @@ -71,11 +67,10 @@ Relative to urlview, urlscan has the following additional features: - Scan certain email headers for URLs. Currently `Link`, `Archived-At` and `List-*` are scanned when `--headers` is passed. -Installation and setup ----------------------- +## Installation and setup To install urlscan, install from your distribution repositories (Archlinux), -from Pypi, or do a local development install with pip -e:: +from Pypi, or do a local development install with pip -e: pip install --user urlscan @@ -83,7 +78,7 @@ from Pypi, or do a local development install with pip -e:: cd && pip install --user -e . -.. NOTE:: +**NOTE** The minimum required version of urwid is 1.2.1. @@ -104,10 +99,7 @@ is not set, xdg-open will control which browser is used, if it's available.: export BROWSER=/usr/bin/epiphany -Command Line usage ------------------- - -:: +## Command Line usage urlscan OPTIONS @@ -142,18 +134,16 @@ the URL can be piped to the command using `--run-safe --pipe` (or `--run`). Using --run-safe with --pipe is preferred if the command supports it, as it is marginally more secure and tolerant of special characters in the URL. -Theming -------- +## Theming Run `urlscan -g` to generate ~/.config/urlscan/config.json with the default color and black & white palettes. This can be edited or added to, as desired. The first palette in the list will be the default. Configure the palettes -according to the `Urwid display attributes`_. +according to the [Urwid display attributes][1]. Display width can be set with `--width`. -Keybindings ------------ +## Keybindings Run `urlscan -g` to generate ~/.config/urlscan/config.json. All of the keys will be listed. You can either leave in place or delete any that will not be altered. @@ -180,13 +170,11 @@ The follow actions are supported: - `top` -- move to first list item (default: `g`) - `up` -- cursor up (default: `k`) -Update TLD list (for developers, not users) -------------------------------------------- +## Update TLD list (for developers, not users) `wget https://data.iana.org/TLD/tlds-alpha-by-domain.txt` -Known bugs and limitations --------------------------- +## Known bugs and limitations - Running urlscan sometimes "messes up" the terminal background. This seems to be an urwid bug, but I haven't tracked down just what's going on. @@ -201,4 +189,4 @@ Known bugs and limitations sub-parts, rather than just picking one, which may lead to URLs and context appearing twice. (Bypass this by selecting the '--dedupe' option) -.. _Urwid display attributes: http://urwid.org/manual/displayattributes.html#display-attributes +[1]: http://urwid.org/manual/displayattributes.html#display-attributes "Urwid display attributes" diff --git a/setup.py b/setup.py index c43bcf4..ad690d8 100755 --- a/setup.py +++ b/setup.py @@ -1,18 +1,30 @@ #!/usr/bin/env python3 +"""urlscan setup.py""" from setuptools import setup + +def long_description(): + """Generate long description from README""" + with open("README.md") as readme: + return readme.read() + + setup(name="urlscan", - version="0.9.6", + version="0.9.7", description="View/select the URLs in an email message or file", + long_description=long_description(), + long_description_content_type="text/markdown", author="Scott Hansen", author_email="firecat4153@gmail.com", url="https://github.com/firecat53/urlscan", download_url="https://github.com/firecat53/urlscan/archive/0.9.6.zip", packages=['urlscan'], - scripts=['bin/urlscan'], + entry_points={ + 'console_scripts': ['urlscan=urlscan.__main__:main'] + }, package_data={'urlscan': ['assets/*']}, - data_files=[('share/doc/urlscan', ['README.rst', 'COPYING']), + data_files=[('share/doc/urlscan', ['README.md', 'COPYING']), ('share/man/man1', ['urlscan.1'])], license="GPLv2", install_requires=["urwid>=1.2.1"], @@ -28,5 +40,5 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Topic :: Utilities'], - keywords=("urlscan urlview email mutt tmux"), + keywords="urlscan, urlview, email, mutt, tmux" ) diff --git a/bin/urlscan b/urlscan/__main__.py old mode 100755 new mode 100644 similarity index 100% rename from bin/urlscan rename to urlscan/__main__.py