new setup and print message on nopublish

This commit is contained in:
Michael Murtaugh 2020-05-31 23:30:39 +02:00
parent 30d20810d8
commit c8f4d90d87
4 changed files with 23 additions and 29 deletions

10
Makefile Normal file
View File

@ -0,0 +1,10 @@
clean:
rm -rf build
rm -rf sponge.egg-info
rm -rf __pycache__
install:
pip install -e .

View File

@ -2,21 +2,9 @@ from __future__ import print_function
import re, os, json, sys import re, os, json, sys
from math import ceil, floor from math import ceil, floor
from time import sleep from time import sleep
from urllib.parse import urlparse, urlunparse, urlencode, quote_plus, unquote_plus
try: from urllib.request import urlopen, URLError, HTTPError
# python2 from html.entities import name2codepoint
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
groupnamepat = re.compile(r"^g\.(\w+)\$") groupnamepat = re.compile(r"^g\.(\w+)\$")
def splitpadname (padid): def splitpadname (padid):
@ -76,7 +64,7 @@ def getjson (url, max_retry=3, retry_sleep_time=3):
except ValueError as e: except ValueError as e:
url = "http://localhost" + url url = "http://localhost" + url
except HTTPError as e: 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["_code"] = e.code
ret["_retries"]+=1 ret["_retries"]+=1
if retry_sleep_time: if retry_sleep_time:

View File

@ -1,16 +1,9 @@
from __future__ import print_function
from argparse import ArgumentParser from argparse import ArgumentParser
import sys, json, re, os import sys, json, re, os
from datetime import datetime from datetime import datetime
try: from urllib.parse import urlencode, quote
# python2 from urllib.request import urlopen, URLError, HTTPError
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 etherdump.commands.common import * from etherdump.commands.common import *
from time import sleep from time import sleep
@ -92,6 +85,7 @@ def main (args):
# maxmsglen = 0 # maxmsglen = 0
count = 0 count = 0
for i, padid in enumerate(padids): for i, padid in enumerate(padids):
print (padid, file=sys.stderr)
if args.skip != None and i<args.skip: if args.skip != None and i<args.skip:
continue continue
progressbar(i, numpads, padid) progressbar(i, numpads, padid)
@ -184,6 +178,7 @@ def main (args):
########################################## ##########################################
if args.nopublish and args.nopublish in text: if args.nopublish and args.nopublish in text:
# NEED TO PURGE ANY EXISTING DOCS # NEED TO PURGE ANY EXISTING DOCS
print ("NOPUBLISH", file=sys.stderr)
try_deleting((p+raw_ext,p+".raw.html",p+".diff.html",p+".meta.json")) try_deleting((p+raw_ext,p+".raw.html",p+".diff.html",p+".meta.json"))
continue continue

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import distutils.command.install_lib import setuptools
from distutils.core import setup # import distutils.command.install_lib
# from distutils.core import setup
import os import os
def find (p, d): def find (p, d):
@ -16,7 +17,7 @@ def find (p, d):
# print "**", x # print "**", x
return ret return ret
setup( setuptools.setup(
name='etherdump', name='etherdump',
version='0.3.0', version='0.3.0',
author='Active Archives Contributors', author='Active Archives Contributors',
@ -31,6 +32,6 @@ setup(
description='Etherdump an etherpad publishing & archiving system', description='Etherdump an etherpad publishing & archiving system',
# long_description=open('README.md').read(), # long_description=open('README.md').read(),
install_requires=[ install_requires=[
"html5lib", "jinja2" "html5lib", "jinja2", "python-dateutil", "requests"
] ]
) )