Commit 9981a40b authored by admuc's avatar admuc

pypi/pip initial commit; update files

parent ce32fc05
include a2x3.py
include asciidoc3.conf
include asciidoc3.py
include asciidoc3api.py
include COPYING
include COPYRIGHT
include doc/*.*
include doc/images/
include docbook45.conf
include dblatex/dblatex-readme.txt
include dblatex/asciidoc3-dblatex.sty
include dblatex/asciidoc3-dblatex.xsl
include docbook-xsl/*.txt
include docbook-xsl/*.xsl
include filters/code/code-filter.conf
include filters/code/code-filter.py
include filters/code/code-filter-test.txt
include filters/code/code-filter-readme.txt
include filters/graphviz/graphviz-filter.conf
include filters/graphviz/graphviz2png.py
include filters/graphviz/asciidoc3-graphviz-sample.txt
include filters/graphviz/images/
include filters/latex/latex2png.py
include filters/latex/latex-filter.conf
include filters/music/music-filter.conf
include filters/music/music2png.py
include filters/music/music-filter-test.txt
include filters/music/images/
include filters/source/source-highlight-filter-test.txt
include filters/source/source-highlight-filter.conf
include help.conf
include html4.conf
include html5.conf
include images/icons/callouts/*.png
include images/icons/README
include images/icons/*.png
include images/*.png
include images/*.jpg
include javascripts/*.js
include lang-*.conf
include latex.conf
include LICENSE
include README.md
include slidy.conf
include stylesheets/*.css
include text.conf
include themes/flask/*.css
include themes/volnitsky/*.css
include tests/readme-tests.txt
include vim/readme-vim.txt
include vim/syntax/asciidoc3.vim
include xhtml11.conf
include a2x3.py
include asciidoc3.conf
include asciidoc3.py
include asciidoc3api.py
include COPYING
include COPYRIGHT
include doc/*.*
include doc/images
include docbook45.conf
include dblatex/dblatex-readme.txt
include dblatex/asciidoc3-dblatex.sty
include dblatex/asciidoc3-dblatex.xsl
include docbook-xsl/*.txt
include docbook-xsl/*.xsl
include filters/code/code-filter.conf
include filters/code/code-filter.py
include filters/code/code-filter-test.txt
include filters/code/code-filter-readme.txt
include filters/graphviz/graphviz-filter.conf
include filters/graphviz/graphviz2png.py
include filters/graphviz/asciidoc3-graphviz-sample.txt
include filters/graphviz/images/
include filters/latex/latex2png.py
include filters/latex/latex-filter.conf
include filters/music/music-filter.conf
include filters/music/music2png.py
include filters/music/music-filter-test.txt
include filters/music/images/
include filters/source/source-highlight-filter-test.txt
include filters/source/source-highlight-filter.conf
include help.conf
include html4.conf
include html5.conf
include images/icons/callouts/*.png
include images/icons/README
include images/icons/*.png
include images/*.png
include images/*.jpg
include javascripts/*.js
include lang-*.conf
include latex.conf
include LICENSE
include README.md
include slidy.conf
include stylesheets/*.css
include text.conf
include themes/flask/*.css
include themes/volnitsky/*.css
include tests/readme-tests.txt
include vim/readme-vim.txt
include vim/syntax/asciidoc3.vim
include xhtml11.conf
recursive-include doc *
recursive-include docbook-xsl *
recursive-include filters *
recursive-include images *
recursive-include javascripts *
recursive-include stylesheets *
recursive-include themes *
recursive-include vim *
recursive-include tests *
include *
include a2x3.py
include asciidoc3.conf
include asciidoc3.py
include asciidoc3api.py
include COPYING
include COPYRIGHT
include doc/*.*
include doc/images
include docbook45.conf
include dblatex/dblatex-readme.txt
include dblatex/asciidoc3-dblatex.sty
include dblatex/asciidoc3-dblatex.xsl
include docbook-xsl/*.txt
include docbook-xsl/*.xsl
include filters/code/code-filter.conf
include filters/code/code-filter.py
include filters/code/code-filter-test.txt
include filters/code/code-filter-readme.txt
include filters/graphviz/graphviz-filter.conf
include filters/graphviz/graphviz2png.py
include filters/graphviz/asciidoc3-graphviz-sample.txt
include filters/graphviz/images/
include filters/latex/latex2png.py
include filters/latex/latex-filter.conf
include filters/music/music-filter.conf
include filters/music/music2png.py
include filters/music/music-filter-test.txt
include filters/music/images/
include filters/source/source-highlight-filter-test.txt
include filters/source/source-highlight-filter.conf
include help.conf
include html4.conf
include html5.conf
include images/icons/callouts/*.png
include images/icons/README
include images/icons/*.png
include images/*.png
include images/*.jpg
include javascripts/*.js
include lang-*.conf
include latex.conf
include LICENSE
include README.md
include slidy.conf
include stylesheets/*.css
include text.conf
include themes/flask/*.css
include themes/volnitsky/*.css
include tests/readme-tests.txt
include vim/readme-vim.txt
include vim/syntax/asciidoc3.vim
include xhtml11.conf
name = "asciidoc3"
from . import asciidoc3
if __name__ == '__main__':
asciidoc3.main()
......@@ -879,7 +879,9 @@ class A2X3(AttrDict):
# Script main line.
#####################################################################
if __name__ == '__main__':
#if __name__ == '__main__':
def main():
global OPTIONS
description = '''A toolchain manager for AsciiDoc3
(converts Asciidoc3 text files to other file formats)'''
from optparse import OptionParser
......@@ -1006,4 +1008,6 @@ if __name__ == '__main__':
a2x3.execute()
except KeyboardInterrupt:
exit(1)
if __name__ == '__main__':
main()
......@@ -248,7 +248,9 @@ class Message:
if msg == self.prev_msg: # Suppress repeated messages.
return
self.messages.append(msg)
if __name__ == '__main__':
if (__name__ == '__main__' or
__name__ == 'asciidoc3' or
__name__ == 'asciidoc3.asciidoc3'):
sys.stderr.write('%s: %s%s' % (self.PROG, msg, os.linesep))
self.prev_msg = msg
......@@ -469,7 +471,6 @@ def parse_to_list(val):
values = ast.parse("[" + val + "]", mode='eval').body.elts
return [literal_eval(v) for v in values]
def parse_attributes(attrs, dict):
"""Update a dictionary with name/value attributes from the attrs string.
The attrs string is a comma separated list of values and keyword name=value
......@@ -720,6 +721,7 @@ def dump_section(name, dict, f=sys.stdout):
f.write('%s%s' % (s, writer.newline))
f.write(writer.newline)
def update_attrs(attrs, dict):
"""Update 'attrs' dictionary with parsed attributes in dictionary 'dict'."""
for k, v in list(dict.items()):
......@@ -4197,6 +4199,7 @@ class Macros:
# Default system macro syntax.
SYS_RE = r'^(?P<name>[\\]?\w(\w|-)*?)::(?P<target>\S*?)' + \
r'(\[(?P<attrlist>.*?)\])$'
def __init__(self):
self.macros = [] # List of Macros.
self.current = None # The last matched block macro.
......@@ -4207,6 +4210,7 @@ class Macros:
m.prefix = '+'
m.reo = re.compile(m.pattern)
self.macros.append(m)
def load(self, entries):
for entry in entries:
m = Macro()
......@@ -4227,6 +4231,7 @@ class Macros:
break
else:
self.macros.append(m)
def dump(self):
write = lambda s: sys.stdout.write('%s%s' % (s, writer.newline))
write('[macros]')
......@@ -4238,12 +4243,14 @@ class Macros:
macro += '[' + ','.join(m.subslist) + ']'
write(macro)
write('')
def validate(self):
# Check all named sections exist.
if config.verbose:
for m in self.macros:
if m.name and m.prefix != '+':
m.section_name()
def subs(self, text, prefix='', callouts=False):
# If callouts is True then only callout macros are processed, if False
# then all non-callout macros are processed.
......@@ -6181,7 +6188,9 @@ def asciidoc3(backend, doctype, confiles, infile, outfile, options):
if isinstance(e, EAsciiDoc):
message.stderr('%s%s' % (msg, str(e)))
else:
if __name__ == '__main__':
if (__name__ == '__main__' or
__name__ == 'asciidoc3' or
__name__ == 'asciidoc3.asciidoc3'):
message.stderr(msg+'unexpected error:')
message.stderr('-'*60)
traceback.print_exc(file=sys.stderr)
......@@ -6335,9 +6344,14 @@ def execute(cmd, opts, args):
finally:
sys.stdin, sys.stdout = stdin, stdout
if __name__ == '__main__':
#if __name__ == '__main__':
def main():
# Process command line options.
import getopt
global opts
global args
global opt_names
global count
try:
#DEPRECATED: --unsafe option.
opts, args = getopt.getopt(sys.argv[1:],
......@@ -6384,3 +6398,6 @@ if __name__ == '__main__':
execute(sys.argv[0], opts, args)
except KeyboardInterrupt:
sys.exit(1)
if __name__ == '__main__':
main()
#!/usr/bin/env python3
"""
asciidoc3_postinstall.py
Copyright (C) 2018 by Berthold Gehrke <berthold.gehrke@gmail.com>
Free use of this software is granted under the terms of the
GNU General Public License Version 2 or higher (GNU GPLv2+).
"""
import os
import re
import shutil
import subprocess
import sys
USERHOMEDIR = os.path.expanduser("~") # e.g. GNU/Linux: USERHOMEDIR = '/home/username'
def main():
AD3_LOCATION = ''
try:
p = subprocess.Popen("pip show asciidoc3", shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, universal_newlines=True, bufsize=-1)
output = p.communicate()
except Exception:
print('error')
if output:
output = output[0]
o = re.split(r'Location: ', output, re.DOTALL)[1]
o = re.split(r'\nRequires', o, re.DOTALL)[0]
# sample o
# '/home/username/.local/lib/python3.5/site-packages', type: <class 'str'>
AD3_LOCATION = o
else:
# no output
sys.exit(1)
# symlinks, user home
if os.path.exists(USERHOMEDIR + "/.asciidoc3"):
os.replace(USERHOMEDIR + "/.asciidoc3", USERHOMEDIR + "/.asciidoc3_backup")
os.symlink(AD3_LOCATION + "/asciidoc3", USERHOMEDIR + "/.asciidoc3")
if os.path.exists(USERHOMEDIR + "/asciidoc3"):
os.replace(USERHOMEDIR + "/asciidoc3", USERHOMEDIR + "/asciidoc3_backup")
os.symlink(AD3_LOCATION + "/asciidoc3", USERHOMEDIR + "/asciidoc3")
# internal symlinks
if os.path.exists(AD3_LOCATION + "/asciidoc3/doc/images"):
os.unlink(AD3_LOCATION + "/asciidoc3/doc/images")
os.symlink(AD3_LOCATION + "/asciidoc3/images",
AD3_LOCATION + "/asciidoc3/doc/images")
if os.path.exists(AD3_LOCATION + "/asciidoc3/filters/graphviz/images"):
os.unlink(AD3_LOCATION + "/asciidoc3/filters/graphviz/images")
os.symlink(AD3_LOCATION + "/asciidoc3/images",
AD3_LOCATION + "/asciidoc3/filters/graphviz/images")
if os.path.exists(AD3_LOCATION + "/asciidoc3/filters/music/images"):
os.unlink(AD3_LOCATION + "/asciidoc3/filters/music/images")
os.symlink(AD3_LOCATION + "/asciidoc3/images",
AD3_LOCATION + "/asciidoc3/filters/music/images")
if __name__ == '__main__':
main()
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment