Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare the environment of Sphinx documentation (Issue 138) #34

Closed
wants to merge 24 commits into from

Conversation

assem-ch
Copy link
Contributor

http://trac.xapian.org/ticket/138

  • Preparing the environment
  • Integrating "getting started" documentation within it
  • Automating the version
  • Link it to the global building system
  • Apply the same on python 3

You can browse how it looks here: http://xapian.alfanous.org/

what's next?

  • Check building doc errors
  • An extension for sphinx to include function declared by assignment
MultiValueKeyMaker.add_value = new_instancemethod(_xapian.MultiValueKeyMaker_add_value,None,MultiValueKeyMaker)

Dependencies:
python-sphinx

(Based on commands suggested by James on issue xapian#138 )

+ Costumization of Project Name, Author, Version and Release
- Makefile, configuration file, index file
- Remove the recent sh script, no need for creating the env each time
Since the getting started is using rst syntax so I integrated it with
the API modules documentation. The user now can view all python docs
in the same place

I also add the examples code into documentation
Listing by module is completely a mess, it shows irrelvant details and unsorted
# The short X.Y version.
version = '1.3.1'
# The full version, including alpha/beta/rc tags.
release = '1.3.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't have hard-coded version numbers in scripts like this, or else they'll just end up out of date.

Either this file needs to be generated (adding a .in suffix and changing 1.3.1 to @VERSION@, and then adding it to the list of files in AC_CONFIG_FILES in configure.ac should do the trick, possibly plus a bit of work to support srcdir!=builddir), or else something like passing VERSION from the Makefile as a command line argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done by passing @VERSION@

- Include examples from an separated files instead of write them directly
- Fix an underlining of a title
- Reduce max levels to 2 in table of contents
- Merging new sphinx based with the old one
- updating the build
- Keep automated the generation of library members
-case "$@" in */*) d=`echo "$@"|sed 's,/[^/]*$$,,'`; test -d "$$d" || mkdir "$$d" ;; esac
$(RST2HTML) --exit-status=warning $< $@
build-sphinx-doc:
export PYTHONPATH=$$PWD:$$PYTHONPATH;cd docs/; sphinx-build -b html -d _build/doctrees . _build/html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$PWD isn't portable (POSIX requires it, but traditional shells don't support it).

Using export and setting a value at the same time also isn't portable (again, POSIX requires it but older shells don't support it).

It's more robust to use && after the cd, so the rule fails if the docs directory doesn't exist rather than generating documentation in the wrong directory.

I'd also avoid the trailing slash on docs/ - some tools can be a bit fussy about them (especially on the commercial Unix platforms) - I don't recall particularly if cd dislikes them anywhere, but it seems cleaner without the slash anyway.

Putting that all together, my suggestion would be:

cd docs && PYTHONPATH=..:$$PYTHONPATH sphinx-build -b html -d _build/doctrees .  _build/html

(A relative path in PYTHONPATH works, as we already use . in the run-python-test script.)

assem-ch and others added 9 commits May 29, 2014 13:45
following olly comments:
==============
$PWD isn't portable (POSIX requires it, but traditional shells don't support it).

Using export and setting a value at the same time also isn't portable (again, POSIX requires it but older shells don't support it).

It's more robust to use && after the cd, so the rule fails if the docs directory doesn't exist rather than generating documentation in the wrong directory.

I'd also avoid the trailing slash on docs/ - some tools can be a bit fussy about them (especially on the commercial Unix platforms) - I don't recall particularly if cd dislikes them anywhere, but it seems cleaner without the slash anyway.

Putting that all together, my suggestion would be:

cd docs && PYTHONPATH=..:$$PYTHONPATH sphinx-build -b html -d _build/doctrees .  _build/html
(A relative path in PYTHONPATH works, as we already use . in the run-python-test script.)
===============
( remove an emptyline added by mistake in HACKING  )
+ no need to add docs/conf.py in EXTRA_DIST
.rst.html:
-case "$@" in */*) d=`echo "$@"|sed 's,/[^/]*$$,,'`; test -d "$$d" || mkdir "$$d" ;; esac
$(RST2HTML) --exit-status=warning $< $@
$(sphinxdocs): xapian/__init__.py docs/conf.py $(srcdir)/docs/*.rst $(dist_exampledata_DATA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really need a variable (e.g. RST_DOCS) which lists the actual rst sources, then use that here instead of the wildcard, and include $(RST_DOCS) in EXTRA_DIST above instead of just removing index.rst. Without the latter, the rst sources won't be included in the tarball of sources.

@assem-ch
Copy link
Contributor Author

assem-ch commented Jun 7, 2014

I fixed that in assem-ch@9f7b849

@ojwb
Copy link
Contributor

ojwb commented Jun 8, 2014

The wildcard part seems unchanged.

@assem-ch
Copy link
Contributor Author

assem-ch commented Jun 8, 2014

I didnt get you

@ojwb
Copy link
Contributor

ojwb commented Jun 12, 2014

Above I suggested that $(RST_DOCS) should also be used instead of the wildcard in the code I commented on (i.e. instead of $(srcdir)/docs/*.rst).

When srcdir != build, VPATH is set to $(srcdir), so I think you won't need to worry about not having $(srcdir)/ in front of each file, as make will automatically look in VPATH if they aren't found from the current directory.

@assem-ch
Copy link
Contributor Author

check the last commit 5961c93

@ojwb
Copy link
Contributor

ojwb commented Jun 16, 2014

Thanks, merged via SVN.

There was an inconsistency as to whether the Python3 introduction was called introduction.rst or introduction3.rst which I had to fix before those docs would build, so I've committed that change too.

@ojwb ojwb closed this Jun 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants