From c8f4d90d87b8bf0c9bb087140d37ac1d18487907 Mon Sep 17 00:00:00 2001 From: Michael Murtaugh Date: Sun, 31 May 2020 23:30:39 +0200 Subject: [PATCH] new setup and print message on nopublish --- Makefile | 10 ++++++++++ etherdump/commands/common.py | 20 ++++---------------- etherdump/commands/pull.py | 13 ++++--------- setup.py | 9 +++++---- 4 files changed, 23 insertions(+), 29 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b5747dc --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +clean: + rm -rf build + rm -rf sponge.egg-info + rm -rf __pycache__ + + +install: + pip install -e . + + diff --git a/etherdump/commands/common.py b/etherdump/commands/common.py index cd5b0a0..9a37ecd 100644 --- a/etherdump/commands/common.py +++ b/etherdump/commands/common.py @@ -2,21 +2,9 @@ from __future__ import print_function import re, os, json, sys from math import ceil, floor from time import sleep - -try: - # python2 - from urlparse import urlparse, urlunparse - from urllib2 import urlopen, URLError, HTTPError - from urllib import urlencode - from urllib import quote_plus, unquote_plus - from htmlentitydefs import name2codepoint - - input = raw_input -except ImportError: - # python3 - from urllib.parse import urlparse, urlunparse, urlencode, quote_plus, unquote_plus - from urllib.request import urlopen, URLError, HTTPError - from html.entities import name2codepoint +from urllib.parse import urlparse, urlunparse, urlencode, quote_plus, unquote_plus +from urllib.request import urlopen, URLError, HTTPError +from html.entities import name2codepoint groupnamepat = re.compile(r"^g\.(\w+)\$") def splitpadname (padid): @@ -76,7 +64,7 @@ def getjson (url, max_retry=3, retry_sleep_time=3): except ValueError as e: url = "http://localhost" + url except HTTPError as e: - print ("HTTPError {0}".format(e), file=sys.stderr) + print ("HTTPError {0} {0}".format(url, e), file=sys.stderr) ret["_code"] = e.code ret["_retries"]+=1 if retry_sleep_time: diff --git a/etherdump/commands/pull.py b/etherdump/commands/pull.py index cfe5061..0659cbf 100644 --- a/etherdump/commands/pull.py +++ b/etherdump/commands/pull.py @@ -1,16 +1,9 @@ -from __future__ import print_function from argparse import ArgumentParser import sys, json, re, os from datetime import datetime -try: - # python2 - from urllib2 import urlopen, URLError, HTTPError - from urllib import urlencode -except ImportError: - # python3 - from urllib.parse import urlencode, quote - from urllib.request import urlopen, URLError, HTTPError +from urllib.parse import urlencode, quote +from urllib.request import urlopen, URLError, HTTPError from etherdump.commands.common import * from time import sleep @@ -92,6 +85,7 @@ def main (args): # maxmsglen = 0 count = 0 for i, padid in enumerate(padids): + print (padid, file=sys.stderr) if args.skip != None and i