move markup parsing to utils.py with a test script

This commit is contained in:
2019-10-16 16:54:45 -07:00
parent 7803ae2fb1
commit 6be415a1df
4 changed files with 173 additions and 0 deletions

0
markup/work/__init__.py Normal file
View File

38
markup/work/test_pdf.py Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env python3
import sys
import os
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
parentparentdir = os.path.dirname(parentdir)
sys.path.insert(0, parentparentdir)
import dumper
import getopt
import django
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'procat2.settings')
django.setup()
from markup.utils import parse_pdf
from procat2.settings import ASSET_DIR
def main(argv):
def usage():
print('usage: %s [-d] file ...' % argv[0])
return 100
try:
(opts, args) = getopt.getopt(argv[1:], 'd')
except getopt.GetoptError:
return usage()
if not args: return usage()
debug = 0
for (k, v) in opts:
if k == '-d': debug += 1
parse_pdf(args[0], debug)
if __name__ == '__main__': sys.exit(main(sys.argv))