add documentation

This commit is contained in:
Mathieu Virbel 2014-04-20 18:09:07 +02:00
parent 6286519d20
commit a001bb484f
6 changed files with 689 additions and 0 deletions

177
docs/Makefile Normal file
View file

@ -0,0 +1,177 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Buildozer.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Buildozer.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Buildozer"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Buildozer"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

242
docs/make.bat Normal file
View file

@ -0,0 +1,242 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
set I18NSPHINXOPTS=%SPHINXOPTS% source
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Buildozer.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Buildozer.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %BUILDDIR%/..
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %BUILDDIR%/..
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end

46
docs/source/index.rst Normal file
View file

@ -0,0 +1,46 @@
.. Buildozer documentation master file, created by
sphinx-quickstart on Sun Apr 20 16:56:31 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Buildozer's documentation!
=====================================
Buildozer is a tool that aim to package mobiles application easily. It
automates the entire build process, download the prerequisites like
python-for-android, Android SDK, NDK, etc.
Buildozer manage a file named `buildozer.spec` in your application directory,
describing your application requirements and settings such as title, icon,
included modules etc. It will use the specification file to create a package
for Android, iOS, and more.
Currently, Buildozer supports packaging for:
- Android: via `Python for Android
<https://github.com/kivy/python-for-android>`_. You must have a Linux or OSX
computer to be able to compile for Android.
- iOS: via `Kivy iOS <https://github.com/kivy/kivy-ios>`_. You must have an OSX
computer to be able to compile for iOS.
- Supporting others platform is in the roadmap (such as .exe for Windows, .dmg
for OSX, etc.)
If you have any questions about Buildozer, please refer to the `Kivy's user
mailing list <https://groups.google.com/forum/#!forum/kivy-users>`_.
.. toctree::
:maxdepth: 2
installation
quickstart
specifications
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View file

@ -0,0 +1,18 @@
Installation
============
Buildozer itself doesn't depend on any library, and works on Python 2.7 and >=
3.3. Depending the platform you'll target, you might need more tools installed.
Buildozer tries to give you hints or try to install few things for you, but it
doesn't cover all the cases.
First, install the buildozer project with::
pip install --upgrade buildozer
If you target Android, you must install at least Cython, few build libs, a Java
SDK. Some binaries of the Android SDK are still in 32 bits, so you need few
32bits libraries available::
pip install --upgrade cython
apt-get install ccache lib32stdc++6 openjdk-7-jdk

View file

@ -0,0 +1,69 @@
Quickstart
==========
Let's get started with Buildozer!
Init and build for Android
--------------------------
#. Buildozer will try to guess the version of your application, by searching a
line like `__version__ = "1.0.3"` in your `main.py`. Ensure you have one at
the start of your application. It is not mandatory but heavilly advised.
#. Create a `buildozer.spec` file, with::
buildozer init
#. Edit the `buildozer.spec` according to the :ref:`specifications`. You should
at least change the `title`, `package.name` and `package.domain` in the
`[app]` section.
#. Start a Android/debug build with::
buildozer -v android debug
#. Now it's time for a coffee / tea, or a dinner if you have a slow computer.
The first build will be slow, as it will download the Android SDK, NDK, and
others tools needed for the compilation.
Don't worry, thoses files will be saved in a global directory and will be
shared accross the different project you'll manage with Buildozer.
#. At the end, you should have an APK file in the `bin/` directory.
Run my application
------------------
Buildozer is able to deploy the application on your mobile, run it, and even
get back the log into the console. It will work only if you already compiled
your application at least once::
buildozer android deploy run logcat
For iOS, it would look the same::
buildozer ios deploy run
You can combine the compilation with the deployment::
buildozer -v android debug deploy run logcat
You can also set this line at the default command to do if Buildozer is started
without any arguments::
buildozer setdefault android debug deploy run logcat
# now just type buildozer, and it will do the default command
buildozer
Install on non-connected devices
--------------------------------
If you have compiled a package, and want to share it easily with others
devices, you might be interested with the `serve` command. It will serve the
`bin/` directory over HTTP. Then you just have to access to the URL showed in
the console from your mobile::
buildozer serve

View file

@ -0,0 +1,137 @@
Specifications
==============
This document explain in details all the configuration token you can use in
`buildozer.spec`.
Section [app]
-------------
- `title`: String, title of your application.
It might possible that some characters are not working depending the paltform
targetted. Best for you is to try and see. Try to avoid too-long title, as
they will also not fit in the title displayed under the icon.
- `package.name`: String, package name.
The Package name is one word with only ASCII characters and/or numbers. It
should not contain any special characters. For example, if your application
is named `Flat Jewels`, the package name can be `flatjewels`.
- `package.domain`: String, package domain.
Package domain is a string that reference the company or individual that did
it. Both domain+name will become your application identifier for Android and
iOS. Choose it carefully. As an example, when the Kivy`s team is publishing
an application, the domain starts with `org.kivy`.
- `source.dir`: String, location of your application sources.
The location must be a directory that contain a `main.py` file. It defaults
to the same directory as the one `buildozer.spec` is.
- `source.include_exts`: List, files extensions to include.
By default, not all the file in your `source.dir` are included, but only some
of them, depending the extension. Ie, we includes `py,png,jpg,kv,atlas`. Feel
free to add your own extensions, or put an empty value if you want to include
everything.
- `source.exclude_exts`: List, files extensions to exclude.
In contrary to `source.include_exts`, you could include all the files you
want except the one that ends with an extension contain in this token. If
empty, no files will be excluded by the extensions.
- `source.exclude_dirs`: List, directories to exclude.
Same as `source.exclude_exts`, but for directory. You can exclude your
`tests` or `bin` directory with::
source.exclude_dirs = tests, bin
- `source.exclude_patterns`: List, file to exclude if they match a pattern.
If you have a more complex application layout, you might need a pattern to
exclude files. It works also even if you don't have a pattern. For example::
source.exclude_patterns = license,images/originals/*
- `version.regex`: Regex, Regular expression to capture the version in
`version.filename`.
The default capture method of your application version is by grepping a line
like that::
__version__ = "1.0"
The `1.0` will be used as a version.
- `version.filename`: String, default to the main.py.
Filename to use for capturing the version with `version.regex`.
- `version`: String, manual application version.
If you don't want to capture the version, comment both of `version.regex` and
`version.filename`, then put the version you want directly in the `version`
token::
# version.regex =
# version.filename =
version = 1.0
- `requirements`: List, Python module or extensions that your application
require.
The requirements can be either a name of a recipe in the Python-for-android
project, or a pure-Python package. For example, if your application require
Kivy and requests, you need to write::
requirements = kivy,requests
If your application try to install a Python extension (ie, a Python package
that require compilation), and that it doesn't have a recipe associated to
Python-for-android, it will not work. We explicitely disable the compilation
here. If you want to make it work, contribute to the Python-for-android
project by creating a recipe.
- `garden_requirements`: List, Garden packages to include.
Add here the list of Kivy's garden package to include. For example::
garder_requirements = graph
Please note that if it doesn't work, it might be because of the garden
package itself. Refer to the author of the package if he already tested it on
the platform you are targetting, not us.
- `presplash.filename`: String, loading screen of your application.
Presplash is the image showed on the device when the application is loading.
It is called presplash on Android, and Loading image on iOS. The image might
have different requirements depending the platform. Currently, Buildozer
works well only with Android, iOS support is not great on this.
The image must be a JPG or PNG, preferable with Power-of-two size. Ie, an
512x512 image is perfect to target all the devices. The image is not fitted,
scaled, or anything on the device. If you provide a too-large image, it might
not fit on small screens.
- `icon.filename`: String, icon of your application.
The icon of your application. It must be a PNG of 512x512 size to be able to
cover all the various platform requirements.
- `orientation`: String, orientation of the application.
Indicate the orientation that your application support. Defaults to
`landscape`, but can be changed to `portrait` or `all`.
- `fullscreen`: Boolean, fullscreen mode.
Defaults to true, your application will run in fullscreen. Means the status
bar will be hidden. If you want to let the user access to the status bar,
hour, notifications, put to 0.