diff --git a/.gitignore b/.gitignore index 46fbbd9..aec7bd0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ tests/ __pycache__/ *.pyc +build/ +dist/ +Opytex.egg-info/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..965f1c8 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +incude *.rst +recursive-include documentation *.txt *.rst diff --git a/opytex/__init__.py b/opytex/__init__.py new file mode 100644 index 0000000..b6300a5 --- /dev/null +++ b/opytex/__init__.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# encoding: utf-8 + + +__version__ = "0.1" + +from .texenv import texenv + + + +# ----------------------------- +# Reglages pour 'vim' +# vim:set autoindent expandtab tabstop=4 shiftwidth=4: +# cursor: 16 del diff --git a/opytex/__main__.py b/opytex/__main__.py new file mode 100644 index 0000000..807ca8a --- /dev/null +++ b/opytex/__main__.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# encoding: utf-8 + + + +from .opytex import main + +main() + + + +# ----------------------------- +# Reglages pour 'vim' +# vim:set autoindent expandtab tabstop=4 shiftwidth=4: +# cursor: 16 del diff --git a/lib/pythagore.py b/opytex/lib/pythagore.py similarity index 100% rename from lib/pythagore.py rename to opytex/lib/pythagore.py diff --git a/macros/poly2Deg.tex b/opytex/macros/poly2Deg.tex similarity index 100% rename from macros/poly2Deg.tex rename to opytex/macros/poly2Deg.tex diff --git a/opytex.py b/opytex/opytex.py similarity index 96% rename from opytex.py rename to opytex/opytex.py index 35e66b9..f3db549 100755 --- a/opytex.py +++ b/opytex/opytex.py @@ -7,7 +7,7 @@ import optparse import csv from path import path -from texenv import texenv +from .texenv import texenv import math as m import random as rd @@ -29,7 +29,7 @@ export_dict.update({"Expression":Expression,\ "random_str": random_str,\ }) -def main(options): +def produce_and_compile(options): #template = report_renderer.get_template(options.template) template = texenv.get_template(options.template) @@ -82,9 +82,7 @@ def main(options): cwd.cd() -if __name__ == '__main__': - - +def main(): parser = optparse.OptionParser() parser.add_option("-t","--template",action="store",type="string",dest="template", help="File with the template. The name should have the following form tpl_... .") parser.add_option("-o","--output",action="store",type="string",dest="output",help="Base name for output )") @@ -101,7 +99,12 @@ if __name__ == '__main__': print("I need a template!") sys.exit(0) - main(options) + produce_and_compile(options) + +if __name__ == '__main__': + main() + + # ----------------------------- # Reglages pour 'vim' diff --git a/texenv.py b/opytex/texenv.py similarity index 98% rename from texenv.py rename to opytex/texenv.py index b6b5c8e..4a35e68 100644 --- a/texenv.py +++ b/opytex/texenv.py @@ -3,6 +3,8 @@ import jinja2, os +__all__ = ["texenv"] + # Definition of jinja syntax for latex texenv = jinja2.Environment( block_start_string = '\Block{', diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b04641d --- /dev/null +++ b/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +#from distutils.core import setup +from setuptools import setup + +setup(name='Opytex', + version='0.1', + description='Jinja environment for latex with computing macros', + author='Benjamin Bertrand', + author_email='lafrite@poneyworld.net', + packages=['opytex'], + install_requiers=['jinja2', 'pyMath', 'path'], + entry_points = { + "console_scripts": ['opytex= opytex.opytex:main'] + }, + )