hplgit / doconce

Lightweight markup language - document once, include anywhere
http://hplgit.github.io/doconce/doc/web/index.html
Other
311 stars 60 forks source link

Installing doconce as a part of anaconda #19

Closed sakhan007 closed 9 years ago

sakhan007 commented 9 years ago

While trying to follow the answer at: http://stackoverflow.com/questions/29545338/how-to-build-a-non-distribution-non-recipe-existent-packages-for-anaconda/29569096#29569096

I got:

$ conda skeleton pypi doconce
doconce not found, trying Doconce
Using url http://code.google.com/p/doconce/downloads/list (0 B) for Doconce.
Downloading Doconce (use --no-download to skip this step)
Unpacking Doconce...
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

https://github.com/conda/conda-build/issues

Include the output of the command 'conda info' in your report.

Traceback (most recent call last):
File "/home/sohail/anaconda/bin/conda-skeleton", line 5, in <module>
sys.exit(main())
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 188, in main
args_func(args, p)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_build.py", line 321, in args_func
args.func(args, p)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 202, in execute
pypi.main(args, parser)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 376, in main
get_package_metadata(args, package, d, data)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 428, in    get_package_metadata
unpack(join(SRC_CACHE, d['filename']), tempdir)
File "/home/sohail/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 640, in unpack
raise Exception("not a valid source")
Exception: not a valid source

Would some body help??

hplgit commented 9 years ago

DocOnce is not on pypi. Can you try

sudo pip install -e git+https://github.com/hplgit/doconce#egg=doconce --upgrade

and report what happens? This installs DocOnce directly from the github repo.

sakhan007 commented 9 years ago

The install is successful:

$ sudo pip install -e git+https://github.com/hplgit/doconce#egg=doconce --upgrade
Obtaining doconce from git+https://github.com/hplgit/doconce#egg=doconce
Cloning https://github.com/hplgit/doconce to ./src/doconce
Running setup.py egg_info for package doconce

warning: no files found matching '*' under directory 'lib/doconce/doc'
Installing collected packages: doconce
Running setup.py develop for doconce
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files

warning: no files found matching '*' under directory 'lib/doconce/doc'
Creating /usr/local/lib/python2.7/dist-packages/Doconce.egg-link (link to lib)
Adding Doconce 1.0.3 to easy-install.pth file
Installing doconce script to /usr/local/bin

Installed /home/sohail/src/doconce/lib
Successfully installed doconce
Cleaning up...

Its installed in::

$ which doconce
/usr/local/bin/doconce

But now when I try to run test.verify at /doconce/test/

$ python test.verify
Traceback (most recent call last):
File "test.verify", line 13, in <module>
import commands, os, sys, re, doconce.common, time
ImportError: No module named doconce.common

Edit

The problem in my opinion is:

$ which python 
/home/sohail/anaconda/bin/python
hplgit commented 9 years ago

Have you tried to see if you can load the module?

python -c 'import doconce'

?

Note that test.verify tests a lot of will require lots of dependencies that you probably don't have.

sakhan007 commented 9 years ago
python -c 'import doconce'

would clearly not work, since python is in:

/home/sohail/anaconda/bin/python

as stated earlier.

hplgit commented 9 years ago

Seems that your pip is not anaconda pip since it installs under /usr/local. Very strange. When I do the same, pip installs under /anaconda/bin and the libraries are in src/ in the directory where you ran the pip command.

hplgit commented 9 years ago

For testing, try

cd test; py.test test_mintest.py
sakhan007 commented 9 years ago

In /doconce/test/ doing $ py.test returns::

platform linux2 -- Python 2.7.9 -- py-1.4.26 -- pytest-2.6.4
collected 2 items 

test_boots.do.txt .
testdoc.do.txt .

and for test_minitest.py returns error, since its not there.

Moreover my pip also installs at /anaconda but when used with sudo it installs /usr/.

hplgit commented 9 years ago

OK, then you have to drop sudo. Try to install once more, then you will have the test_minitest.py file (I just put it there a couple of hours ago). On which platform are you?

sakhan007 commented 9 years ago

Initially I also tried the pip install without sudo without any success. Now its returning::

$ pip install -e git+https://github.com/hplgit/doconce#egg=doconce --upgrade
Obtaining doconce from git+https://github.com/hplgit/doconce#egg=doconce
Updating ./src/doconce clone
error: cannot open .git/FETCH_HEAD: Permission denied
Complete output from command git fetch -q:
Command "git fetch -q" failed with error code 255 in /home/sohail/src/doconce

Do I need to change some file permissions??? Moreover llsb_release -a returned.

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise
hplgit commented 9 years ago

OK, I don't know why you don't get access to GitHub this way. Then you have to do it the standard way.

git clone https://github.com/hplgit/doconce.git
cd doconce
python setup.py install
sakhan007 commented 9 years ago

I tried that first before coming here as you can see at stackoverflow link posted above. http://stackoverflow.com/questions/29508309/anaconda-could-not-find-my-already-installed-package

I used sudo there since without super user access some files could not be created.

hplgit commented 9 years ago

The problem is probably that sudo applies another python than you as user (this depends on the OS you are running on). Then you have to install any Python package locally,

cd $HOME; mkdir pysoft  # new dir for local installs
python setup.py install --prefix=$HOME/pysoft

Here, python should be anaconda python, and everything gets installed under pysoft. You need to update PYTHONPATH and PATH in .bashrc (Unix) with the appropriate subdirectories of pysoft.

Try to install some simple, trivial Python module instead of doconce (doconce is huge, and this installation problem has nothing to do with doconce). Preprocess (needed by doconce) may be such a package: https://code.google.com/p/preprocess/

sakhan007 commented 9 years ago

I have not tried this yet. Rather I have few question, if you could please take a kind look:

  1. Isn't it better to use /home/sohail/anaconda/lib/python2.7/site-packages/ instead of your purposed pysoft directory?
  2. How can I uninstall doconce installed by sudo python setup.py install?
  3. Why don't you people upload doconce to pypi? I could have done it myself but I don't know whether its ethical or not and secondly I don't have any experience in doing so.
hplgit commented 9 years ago
  1. It's simpler.
  2. You have to remove the library doconce and the executable doconce. Open a python shell with sudo python, do import doconce, check where the library doconce is by printing sys.modules['doconce'], do sudo rm -rf on the root directory of the doconce library. Write which doconce in the terminal and remove the doconce executable.
  3. doconce is a complicated bundle so I thought having it at pypi sends a wrong messag: it's easy to install. That's true if you just need to make html and simple latex documents, but if you really need the power of doconce, there is a lot to install, and doconce itself is the trivial part. But most packages doconce depends on are at pypi, so that's an argument in favor of putting it there.
sakhan007 commented 9 years ago

I have successful brought doconce in anaconda path, now which doconce gives:

/home/sohail/anaconda/bin/doconce

I can also do python -c 'import doconce' without any errors. But now when I do something like: $doconce it says:

$ doconce
Traceback (most recent call last):
File "/home/sohail/anaconda/bin/doconce", line 4, in <module>
from doconce.misc import system, misc_option
ImportError: No module named doconce.misc

Additionally it is kindly requested to please upload doconce to pypi, since this make it very easy to install it through pip and also to include it into anaconda due to pip. Actually pypi already has a doconce version: https://pypi.python.org/pypi/Doconce/0.5.1

hplgit commented 9 years ago

Which version of Python have you installed? You must also check sys.modules['doconce'] (after import) and that misc.py etc are found in the directory where the doconce library is installed. (Again, I would experiment with a simple module like preprocess to make sure you understand how to install third-party software under anaconda before I would address a huge package like doconce.)

Since an old doconce is already at pypi, we have to either remove it or upload a recent version.

sakhan007 commented 9 years ago

My python version is: 2.7.9 While checking for sys.modules['doconce'], here is what I did:

$ python
   Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar  9 2015, 16:20:48) 
   [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
   Type "help", "copyright", "credits" or "license" for more information.
   Anaconda is brought to you by Continuum Analytics.
   Please check out: http://continuum.io/thanks and https://binstar.org

>>> import sys
>>> sys.modules['doconce']
      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
       KeyError: 'doconce'
>>> import doconce
>>> sys.modules['doconce']
<module 'doconce' from '/home/sohail/anaconda/lib/python2.7/site-packages/doconce/__init__.pyc'>
>>> 

Though I have found misc.py in doconce repository but don't know how to overcome that error of missing doconce.misc

I have successfully added preprocess and repeaterspackage from pypi to my conda list of packages through conda skeleton pypi preprocess and then conda build preprocess, once uploaded to binstar.org, I can do conda isntall ... Though conda skeleton command failed for couple of randomly chosenpypi packages due to different reasons.

hplgit commented 9 years ago

Can you do import doconce.misc in the shell?

Seems that the binary doconce runs another python than anaconda... Try to run python /home/sohail/anaconda/bin/doconce to make sure the doconce binary is interpreted by anaconda python. The doconce binary relies on the line #!/usr/bin/env python so you can try to see what shell you get by /usr/bin/env python.

Regarding your test of preprocess, you need to use the same method as you did for doconce - installing it from pypi doesn't help your debugging of the installation. You must clone the directory and do setup.py and check that you can both import preprocess and run it as a binary executable.

sakhan007 commented 9 years ago

Though I do have some dependency issues but I think I have made significant progress and perhaps have solved major portion of my problem; after editing misc.py, please confirm.

$ doconce

DocOnce version 1.0.3
Usage: doconce command [optional arguments]
commands: format help sphinx_dir subst replace replace_from_file clean spellcheck ptex2tex guess_encoding expand_commands expand_mako combine_images change_encoding capitalize gwiki_figsubst md2html md2latex remove_inline_comments apply_inline_edits grab remove remove_exercise_answers split_rst split_html slides_html slides_beamer slides_markdown latin2html grep latex_header latex_footer latex_problems ref_external html_colorbullets list_fig_src_files list_labels teamod sphinxfix_localURLs latex_exercise_toc insertdocstr old2new_format linkchecker latex2doconce latex_dislikes html2doconce pygmentize makefile diff gitdiff fix_bibtex4publish csv2table

# transform doconce file to another format
doconce format html|latex|pdflatex|rst|sphinx|plain|gwiki|mwiki|cwiki|pandoc|st|epytext dofile

# substitute a phrase by another using regular expressions
doconce subst [-s -m -x --restore] regex-pattern regex-replacement file1 file2 ...
(-s is the re.DOTALL modifier, -m is the re.MULTILINE modifier,
 -x is the re.VERBOSE modifier, --restore copies backup files back again)

# replace a phrase by another literally
doconce replace from-text to-text file1 file2 ...
(exact text substutition)

# doconce replace using from and to phrases from file
doconce replace_from_file file-with-from-to file1 file2 ...
(exact text substitution, but a set of from-to relations)

# replace all mako function calls by the results of the calls
doconce expand_mako mako_code_file funcname file1 file2 ...

# remove all inline comments in a doconce file
doconce remove_inline_comments dofile

# apply all edits specified through inline comments
apply_inline_edits

# create a directory for the sphinx format
doconce sphinx_dir author='John Doe' title='Long title' \
    short_title="Short title" version=0.1 intersphinx \
    dirname=sphinx-rootdir theme=default logo=mylogo.png \
    do_file [do_file2 do_file3 ...]
(requires sphinx version >= 1.1)

# walk through a directory tree and insert doconce files as
# docstrings in *.p.py files
doconce insertdocstr rootdir

# remove all files that the doconce format can regenerate
doconce clean

# change encoding
doconce change_encoding utf-8 latin1 dofile

# guess the encoding in a text
doconce guess_encoding filename

# split a sphinx/rst file into parts
doconce format sphinx complete_file
doconce split_rst complete_file        # !split specifies the splitting points
doconce sphinx_dir complete_file
python automake_sphinx.py

# split an html file into parts according to !split commands
doconce split_html complete_file.html

# create HTML slides from a (doconce) html file
doconce slides_html slide_type complete_file.html

# create LaTeX Beamer slides from a (doconce) latex/pdflatex file
doconce slides_beamer complete_file.tex

# create Remark slides from Markdown
doconce slides_markdown complete_file.md remark --slide_style=light

# replace bullets in lists by colored bullets
doconce html_colorbullets file1.html file2.html ...

# grab selected text from a file
doconce grab   --from[-] from-text [--to[-] to-text] somefile > result

# remove selected text from a file
doconce remove --from[-] from-text [--to[-] to-text] somefile > result

# list all figure, movie or included code files
doconce grep FIGURE|MOVIE|CODE dofile

# run spellcheck on a set of files
doconce spellcheck [-d .mydict.txt] *.do.txt

# transform ptex2tex files (.p.tex) to ordinary latex file
# and manage the code environments
doconce ptex2tex mydoc -DMINTED pycod=minted sys=Verbatim \
        dat=\begin{quote}\begin{verbatim};\end{verbatim}\end{quote}

# make HTML file via pandoc from Markdown (.md) file
doconce md2html file.md

# make LaTeX file via pandoc from Markdown (.md) file
doconce md2latex file.md

# combine several images into one
doconce combine_images image1 image2 ... output_file

# report problems from a LaTeX .log file
doconce latex_problems mydoc.log [overfull-hbox-limit]

# list all figure files, movie files, and source code files needed
doconce list_fig_src_files *.do.txt

# list all labels in a document (for purposes of cleaning them up)
doconce list_labels myfile

# generate script for substituting generalized references
doconce ref_external mydoc [pubfile]

# check all links in HTML files
doconce linkchecker *.html

# change headings from "This is a Heading" to "This is a heading"
doconce capitalize [-d .mydict.txt] *.do.txt

# translate a latex document to doconce (requires usually manual fixing)
doconce latex2doconce latexfile

# check if there are problems with translating latex to doconce
doconce latex_dislikes latexfile

# typeset a doconce document with pygments (for pretty print of doconce itself)
doconce pygmentize myfile [pygments-style]

# generate a make.sh script for translating a doconce file to various formats
doconce makefile docname doconcefile [html sphinx pdflatex ...]

# find differences between two files
doconce diff file1.do.txt file2.do.txt [diffprog]
(diffprog can be difflib, diff, pdiff, latexdiff, kdiff3, diffuse, ...)

# find differences between the last two Git versions of several files
doconce gitdiff file1 file2 file3 ...

# convert csv file to doconce table format
doconce csv2table somefile.csv

# edit URLs to local files and place them in _static
doconce sphinxfix_local_URLs file.rst

# replace latex-1 (non-ascii) characters by html codes
doconce latin2html file.html

# fix common problems in bibtex files for publish import
doconce fix_bibtex4publish file1.bib file2.bib ...

# print the header (preamble) for latex file
doconce latex_header

# print the footer for latex files
doconce latex_footer

# expand short cut commands to full form in files
doconce expand_commands file1 file2 ...

# insert a table of exercises in a latex file myfile.p.tex
doconce latex_exercise_toc myfile

$ which doconce

$ python
Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar  9 2015, 16:20:48) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 Anaconda is brought to you by Continuum Analytics.
 Please check out: http://continuum.io/thanks and https://binstar.org
 >>> import sys
 >>> sys.modules['doconce']
 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  KeyError: 'doconce'
  >>> import doconce.misc
  >>> import doconce
  >>> 

Though If I have to do import doconce or import doconce.misc at the terminal shell instead of python shell, then I go a continuous blinking prompt as if it is trying to do something. I have waited for 2 min. in each case but nothing happened. Doing $python /home/sohail/anaconda/bin/doconce runs successfully and generated somewhat same output as $doconce

Doing doconce tests meaning py.test test_mintest.py

============================= test session starts ==============================
platform linux2 -- Python 2.7.9 -- py-1.4.26 -- pytest-2.6.4
collected 4 items

test_mintest.py FFFF

=================================== FAILURES ===================================
______________________________ test_mintest_html _______________________________

    def test_mintest_html():
        filename = '_ref_mintest_bluegray'
        shutil.copy('mintest.do.txt', filename + '.do.txt')
        cmd = 'doconce format html %s --html_style=bootstrap_bluegray --html_output=%s' % (filename, filename)
        failure = os.system(cmd)
        if failure:
            assert False, 'Could not run %s' % cmd
        cmd = 'doconce split_html %s.html' % filename
        failure = os.system(cmd)
        if failure:
            assert False, 'Could not run %s' % cmd

        filenames = [filename+'.html'] + ['._%s%03d.html' % (filename, i)
                                          for i in range(4)]
        for filename in filenames:
            assert_equal_files(filename,
>                              os.path.join('mintest', filename))

test_mintest.py:89: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_mintest.py:69: in assert_equal_files
    msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

text1 = '<!--\nAutomatically generated HTML file from DocOnce source\n(https://github.com/hplgit/doconce/)\n-->\n<html>\n<head...a href="http://..."><img width="250" align=right src="http://..."></a>\n</footer>\n-->\n\n\n</body>\n</html>\n    \n\n'
text2 = '<!--\nAutomatically generated HTML file from DocOnce source\n(https://github.com/hplgit/doconce/)\n-->\n<html>\n<head...a href="http://..."><img width="250" align=right src="http://..."></a>\n</footer>\n-->\n\n\n</body>\n</html>\n    \n\n'
text1_name = '_ref_mintest_bluegray.html'
text2_name = 'mintest/_ref_mintest_bluegray.html'
prefix_diff_files = 'tmp_diff'
msg = 'Load tmp_diff.html into a browser to see differences.'

    def assert_equal_text(text1, text2,
                          text1_name='text1', text2_name='text2',
                          prefix_diff_files='tmp_diff',
                          msg=''):
        if msg != '' and msg[-1] not in ('.', '?', ':', ';', '!'):
            msg += '.'
        if msg != '':
            msg += '\n'
        msg += 'Load tmp_diff.html into a browser to see differences.'
>       assert not pydiff(text1, text2, text1_name, text2_name,
                          prefix_diff_files, n=3), msg
E       AssertionError: Load tmp_diff.html into a browser to see differences.
E       assert not True
E        +  where True = pydiff('<!--\nAutomatically generated HTML file from DocOnce source\n(https://github.com/hplgit/doconce/)\n-->\n<html>\n<head...a href="http://..."><img width="250" align=right src="http://..."></a>\n</footer>\n-->\n\n\n</body>\n</html>\n    \n\n', '<!--\nAutomatically generated HTML file from DocOnce source\n(https://github.com/hplgit/doconce/)\n-->\n<html>\n<head...a href="http://..."><img width="250" align=right src="http://..."></a>\n</footer>\n-->\n\n\n</body>\n</html>\n    \n\n', '_ref_mintest_bluegray.html', 'mintest/_ref_mintest_bluegray.html', 'tmp_diff', n=3)

test_mintest.py:57: AssertionError
----------------------------- Captured stdout call -----------------------------
translating doconce text in _ref_mintest_bluegray.do.txt to html
figure file ../doc/src/manual/fig/wave1D:
    can use ../doc/src/manual/fig/wave1D.png for format html
output in _ref_mintest_bluegray.html
_ref_mintest_bluegray.html now links to the generated files
.__ref_mintest_bluegray000.html, .__ref_mintest_bluegray001.html, .__ref_mintest_bluegray002.html, .__ref_mintest_bluegray003.html
______________________________ test_mintest_latex ______________________________

    def test_mintest_latex():
        filename = '_ref_mintest'
        shutil.copy('mintest.do.txt', filename + '.do.txt')
        cmd = 'doconce format pdflatex %s --latex_code_style=vrb' % filename
        failure = os.system(cmd)
        if failure:
            assert False, 'Could not run %s' % cmd
        filenames = [filename+'.tex']
        for filename in filenames:
>           assert_equal_files(filename, os.path.join('mintest', filename))

test_mintest.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_mintest.py:69: in assert_equal_files
    msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

text1 = '%%\n%% Automatically generated file from DocOnce source\n%% (https://github.com/hplgit/doconce/)\n%%\n\n% #define PRE...------------ end of main content ---------------\n\n\n% #ifdef PREAMBLE\n\\printindex\n\n\\end{document}\n% #endif\n\n'
text2 = '%%\n%% Automatically generated file from DocOnce source\n%% (https://github.com/hplgit/doconce/)\n%%\n\n% #define PRE...------------ end of main content ---------------\n\n\n% #ifdef PREAMBLE\n\\printindex\n\n\\end{document}\n% #endif\n\n'
text1_name = '_ref_mintest.tex', text2_name = 'mintest/_ref_mintest.tex'
prefix_diff_files = 'tmp_diff'
msg = 'Load tmp_diff.html into a browser to see differences.'

    def assert_equal_text(text1, text2,
                          text1_name='text1', text2_name='text2',
                          prefix_diff_files='tmp_diff',
                          msg=''):
        if msg != '' and msg[-1] not in ('.', '?', ':', ';', '!'):
            msg += '.'
        if msg != '':
            msg += '\n'
        msg += 'Load tmp_diff.html into a browser to see differences.'
>       assert not pydiff(text1, text2, text1_name, text2_name,
                          prefix_diff_files, n=3), msg
E       AssertionError: Load tmp_diff.html into a browser to see differences.
E       assert not True
E        +  where True = pydiff('%%\n%% Automatically generated file from DocOnce source\n%% (https://github.com/hplgit/doconce/)\n%%\n\n% #define PRE...------------ end of main content ---------------\n\n\n% #ifdef PREAMBLE\n\\printindex\n\n\\end{document}\n% #endif\n\n', '%%\n%% Automatically generated file from DocOnce source\n%% (https://github.com/hplgit/doconce/)\n%%\n\n% #define PRE...------------ end of main content ---------------\n\n\n% #ifdef PREAMBLE\n\\printindex\n\n\\end{document}\n% #endif\n\n', '_ref_mintest.tex', 'mintest/_ref_mintest.tex', 'tmp_diff', n=3)

test_mintest.py:57: AssertionError
----------------------------- Captured stdout call -----------------------------
translating doconce text in _ref_mintest.do.txt to pdflatex
figure file ../doc/src/manual/fig/wave1D:
    can use ../doc/src/manual/fig/wave1D.pdf for format pdflatex
output in _ref_mintest.tex
______________________________ test_mintest_plain ______________________________

    def test_mintest_plain():
        filename = '_ref_mintest'
        shutil.copy('mintest.do.txt', filename + '.do.txt')
        cmd = 'doconce format plain %s' % filename
        failure = os.system(cmd)
        if failure:
            assert False, 'Could not run %s' % cmd
        filenames = [filename+'.txt']
        for filename in filenames:
>           assert_equal_files(filename, os.path.join('mintest', filename))

test_mintest.py:113: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_mintest.py:69: in assert_equal_files
    msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

text1 = 'A minimal test that DocOnce works\n=================================\n\nHans Petter Langtangen\n\nDate: Apr 16, 2015\...                                   |\n|--------------------------------------------------------------------------|\n\n'
text2 = 'A minimal test that DocOnce works\n=================================\n\nHans Petter Langtangen\n\nDate: Apr 11, 2015\...                                   |\n|--------------------------------------------------------------------------|\n\n'
text1_name = '_ref_mintest.txt', text2_name = 'mintest/_ref_mintest.txt'
prefix_diff_files = 'tmp_diff'
msg = 'Load tmp_diff.html into a browser to see differences.'

    def assert_equal_text(text1, text2,
                          text1_name='text1', text2_name='text2',
                          prefix_diff_files='tmp_diff',
                          msg=''):
        if msg != '' and msg[-1] not in ('.', '?', ':', ';', '!'):
            msg += '.'
        if msg != '':
            msg += '\n'
        msg += 'Load tmp_diff.html into a browser to see differences.'
>       assert not pydiff(text1, text2, text1_name, text2_name,
                          prefix_diff_files, n=3), msg
E       AssertionError: Load tmp_diff.html into a browser to see differences.
E       assert not True
E        +  where True = pydiff('A minimal test that DocOnce works\n=================================\n\nHans Petter Langtangen\n\nDate: Apr 16, 2015\...                                   |\n|--------------------------------------------------------------------------|\n\n', 'A minimal test that DocOnce works\n=================================\n\nHans Petter Langtangen\n\nDate: Apr 11, 2015\...                                   |\n|--------------------------------------------------------------------------|\n\n', '_ref_mintest.txt', 'mintest/_ref_mintest.txt', 'tmp_diff', n=3)

test_mintest.py:57: AssertionError
----------------------------- Captured stdout call -----------------------------
translating doconce text in _ref_mintest.do.txt to plain
*** made link to new HTML file movie_player1.html
    with code to display the movie 
    http://www.youtube.com/embed/P8VcZzgdfSc
*** made link to new HTML file movie_player2.html
    with code to display the movie 
    ../doc/src/manual/mov/wave.webm
output in _ref_mintest.txt
______________________________ test_mintest_ipynb ______________________________

    def test_mintest_ipynb():
        filename = '_ref_mintest'
        shutil.copy('mintest.do.txt', filename + '.do.txt')
        cmd = 'doconce format ipynb %s' % filename
        failure = os.system(cmd)
        if failure:
            assert False, 'Could not run %s' % cmd
        filenames = [filename+'.ipynb']
        for filename in filenames:
>           assert_equal_files(filename, os.path.join('mintest', filename))

test_mintest.py:125: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_mintest.py:69: in assert_equal_files
    msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

text1 = '{\n "metadata": {},\n "nbformat": 3,\n "nbformat_minor": 0,\n "worksheets": [\n  {\n   "cells": [\n    {\n     "cell_... but is not ignored either,\\n",\n      "as in LaTeX and HTML."\n     ]\n    }\n   ],\n   "metadata": {}\n  }\n ]\n}\n'
text2 = '{\n "metadata": {},\n "nbformat": 3,\n "nbformat_minor": 0,\n "worksheets": [\n  {\n   "cells": [\n    {\n     "cell_... but is not ignored either,\\n",\n      "as in LaTeX and HTML."\n     ]\n    }\n   ],\n   "metadata": {}\n  }\n ]\n}\n'
text1_name = '_ref_mintest.ipynb', text2_name = 'mintest/_ref_mintest.ipynb'
prefix_diff_files = 'tmp_diff'
msg = 'Load tmp_diff.html into a browser to see differences.'

    def assert_equal_text(text1, text2,
                          text1_name='text1', text2_name='text2',
                          prefix_diff_files='tmp_diff',
                          msg=''):
        if msg != '' and msg[-1] not in ('.', '?', ':', ';', '!'):
            msg += '.'
        if msg != '':
            msg += '\n'
        msg += 'Load tmp_diff.html into a browser to see differences.'
>       assert not pydiff(text1, text2, text1_name, text2_name,
                          prefix_diff_files, n=3), msg
E       AssertionError: Load tmp_diff.html into a browser to see differences.
E       assert not True
E        +  where True = pydiff('{\n "metadata": {},\n "nbformat": 3,\n "nbformat_minor": 0,\n "worksheets": [\n  {\n   "cells": [\n    {\n     "cell_... but is not ignored either,\\n",\n      "as in LaTeX and HTML."\n     ]\n    }\n   ],\n   "metadata": {}\n  }\n ]\n}\n', '{\n "metadata": {},\n "nbformat": 3,\n "nbformat_minor": 0,\n "worksheets": [\n  {\n   "cells": [\n    {\n     "cell_... but is not ignored either,\\n",\n      "as in LaTeX and HTML."\n     ]\n    }\n   ],\n   "metadata": {}\n  }\n ]\n}\n', '_ref_mintest.ipynb', 'mintest/_ref_mintest.ipynb', 'tmp_diff', n=3)

test_mintest.py:57: AssertionError
----------------------------- Captured stdout call -----------------------------
translating doconce text in _ref_mintest.do.txt to ipynb
figure file ../doc/src/manual/fig/wave1D:
    can use ../doc/src/manual/fig/wave1D.png for format ipynb
collected all required additional files in ipynb-_ref_mintest-src.tar.gz which must be distributed with the notebook
output in _ref_mintest.ipynb
----------------------------- Captured stderr call -----------------------------
tar: Removing leading `../' from member names
tar: Removing leading `../' from hard link targets
=========================== 4 failed in 1.39 seconds ===========================

Finally I have created a do.txt file. I can successfully execute $doconce format latex myfile.do.txt but the tex file needs very high level of editing, for example the tables could not be displayed. I think the problem is with the dependancies.

Could you please guide me further.

hplgit commented 9 years ago

There was a problem with the date in the test_mintest.py unit test, but this is now corrected. Run py.test test_mintest.py. Take a git pull in the doconce directory to update and rerun setup.py (doconce is frequently updated and that is why git clone and running setup.py is much better for you than anaconda install).

Regarding your latex problem, there should be no problems with dependencies if you have latex installed, but I cannot help unless I have the .do.txt file.

sakhan007 commented 9 years ago

I have successfully rerun the test_mintest.py.

The reporting of error with latex was incorrect. gnome-open messed it up. Sorry for that.

Do we have any way of getting a list for all dependencies required by doconce rather than just have to look manually at the installation instructions? I am interested in making as many as dependencies available at binstar.org as I could, so as others may not have to go through the same hassle.

hplgit commented 9 years ago

I think the .txt or .sh/.py files in doc/src/manual listing the dependencies are the best we have. It is difficult to list dependencies without being as precise as mentioning the package name and package installation tool since some packages are split and go under other name in other distributions.

We have a local guy here who is now into packaging doconce for binstar.org.