Sfoglia il codice sorgente

sphinx-to-rst: Also process includes

Ask Solem 15 anni fa
parent
commit
ac82259f7d
3 ha cambiato i file con 72 aggiunte e 7 eliminazioni
  1. 32 4
      README.rst
  2. 10 2
      contrib/sphinx-to-rst.py
  3. 30 1
      docs/includes/introduction.txt

+ 32 - 4
README.rst

@@ -40,8 +40,7 @@ Example
 
 You probably want to see some code by now, so I'll give you an example task
 adding two numbers:
-
-.. code-block:: python
+::
 
     from celery.decorators import task
 
@@ -69,7 +68,7 @@ Features
       be *guaranteed that the task is only executed once.*
 
     * Tasks are executed *concurrently* using the Python 2.6
-      :mod:`multiprocessing` module (also available as a back-port
+      ``multiprocessing`` module (also available as a back-port
       to older python versions)
 
     * Supports *periodic tasks*, which makes it a (better) replacement
@@ -131,7 +130,36 @@ is hosted at Github.
 Installation
 =============
 
-.. include:: installation.txt
+You can install ``celery`` either via the Python Package Index (PyPI)
+or from source.
+
+To install using ``pip``,::
+
+    $ pip install celery
+
+To install using ``easy_install``,::
+
+    $ easy_install celery
+
+Downloading and installing from source
+--------------------------------------
+
+Download the latest version of ``celery`` from
+http://pypi.python.org/pypi/celery/
+
+You can install it by doing the following,::
+
+    $ tar xvfz celery-0.0.0.tar.gz
+    $ cd celery-0.0.0
+    $ python setup.py build
+    # python setup.py install # as root
+
+Using the development version
+------------------------------
+
+You can clone the repository by doing the following::
+
+    $ git clone git://github.com/ask/celery.git
 
 A look inside the components
 ============================

+ 10 - 2
contrib/sphinx-to-rst.py

@@ -13,9 +13,17 @@ RE_REFERENCE = re.compile(r':(.+?):`(.+?)`')
 
 
 def include_file(lines, pos, match):
-    filename = os.path.join(dirname, match.groups()[0])
+    global dirname
+    orig_filename = match.groups()[0]
+    filename = os.path.join(dirname, orig_filename)
     with file(filename) as fh:
-        lines[pos] = "".join(fh.readlines())
+        old_dirname = dirname
+        dirname = os.path.dirname(orig_filename)
+        try:
+            lines[pos] = sphinx_to_rst(fh)
+        finally:
+            dirname = old_dirname
+
 
 
 def replace_code_block(lines, pos, match):

+ 30 - 1
docs/includes/introduction.txt

@@ -127,7 +127,36 @@ is hosted at Github.
 Installation
 =============
 
-.. include:: installation.txt
+You can install ``celery`` either via the Python Package Index (PyPI)
+or from source.
+
+To install using ``pip``,::
+
+    $ pip install celery
+
+To install using ``easy_install``,::
+
+    $ easy_install celery
+
+Downloading and installing from source
+--------------------------------------
+
+Download the latest version of ``celery`` from
+http://pypi.python.org/pypi/celery/
+
+You can install it by doing the following,::
+
+    $ tar xvfz celery-0.0.0.tar.gz
+    $ cd celery-0.0.0
+    $ python setup.py build
+    # python setup.py install # as root
+
+Using the development version
+------------------------------
+
+You can clone the repository by doing the following::
+
+    $ git clone git://github.com/ask/celery.git
 
 A look inside the components
 ============================