Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pyreport/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import __builtin__ # to override import ! :->
import platform
import tokenize
import token
import token as pytoken # rename for when python target code uses "token" as variable

# Local imports
from options import allowed_types, default_options, HAVE_PDFLATEX, \
Expand Down Expand Up @@ -397,7 +397,7 @@ def py2commentblocks(string, firstlinenum, options):
else:
last_token = tokendesc[0]

tokentype = token.tok_name[tokendesc[0]]
tokentype = pytoken.tok_name[tokendesc[0]]
startpos = tokendesc[2][1]
tokencontent = tokendesc[1]
if tokendesc[2][0] > linenum:
Expand Down Expand Up @@ -511,10 +511,12 @@ def tex2pdf(filename, options):
execute("dvips -E %s.dvi -o %s.eps" % (filename, filename))
elif options.outtype == "pdf":
if HAVE_PDFLATEX:
execute( "pdflatex --interaction scrollmode %s.tex -output-directory=%s" %(filename, os.path.dirname(filename)))
# Latex should be compiled multiple times for correct toc, links, tables, etc
execute( "pdflatex --interaction scrollmode '%s.tex' -output-directory='%s'" %(filename, os.path.dirname(filename)))
execute( "pdflatex --interaction scrollmode '%s.tex' -output-directory='%s'" %(filename, os.path.dirname(filename)))
else:
execute("latex --interaction scrollmode %s.tex -output-directory=%s" %(filename, os.path.dirname(filename)))
execute("dvips -E %s.dvi -o %s.eps" % (filename, filename))
execute("latex --interaction scrollmode '%s.tex' -output-directory='%s'" %(filename, os.path.dirname(filename)))
execute("dvips -E '%s.dvi' -o '%s.eps'" % (filename, filename))
print "Doing pdf %s" % filename
execute("epstopdf %s.eps" % filename)

Expand Down
6 changes: 6 additions & 0 deletions pyreport/pyreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ def commandline_call():
else:
pyfile = open(args[0],"r")

# fix include path
from os.path import dirname, abspath
path_of_pyfile = dirname(abspath(args[0]))
sys.path.insert(0, path_of_pyfile)
print sys.path

# Store the name of the input file for later use
options.update({'infilename':args[0]})

Expand Down