Skip to content
Snippets Groups Projects
Commit 35d413f3 authored by Stefano Rivera's avatar Stefano Rivera
Browse files

New upstream version 3.5.0+git20211031.e6458ec

parent 392fef29
No related branches found
No related tags found
No related merge requests found
Showing
with 1238 additions and 7346 deletions
...@@ -16,7 +16,7 @@ ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ ...@@ -16,7 +16,7 @@ ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
$(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
.PHONY: help checkout update build html htmlhelp latex text changes linkcheck \ .PHONY: help checkout update build html htmlhelp latex text changes linkcheck \
suspicious coverage htmlview distclean clean dist check serve \ suspicious coverage htmlview clean dist check serve \
autobuild-dev autobuild-stable autobuild-dev autobuild-stable
help: help:
...@@ -102,8 +102,6 @@ coverage: build ...@@ -102,8 +102,6 @@ coverage: build
htmlview: html htmlview: html
$(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
distclean: clean
clean: clean:
-rm -rf build/* -rm -rf build/*
-rm -rf tools/sphinx -rm -rf tools/sphinx
...@@ -111,6 +109,9 @@ clean: ...@@ -111,6 +109,9 @@ clean:
-rm -rf tools/jinja2 -rm -rf tools/jinja2
-rm -rf tools/docutils -rm -rf tools/docutils
distclean: clean
rm -f Makefile
dist: dist:
rm -rf dist rm -rf dist
mkdir -p dist mkdir -p dist
......
...@@ -5,22 +5,6 @@ ...@@ -5,22 +5,6 @@
Changes Changes
******* *******
.. _changes_from_3_4_1:
Changes from version 3.4.1
==========================
New Features
------------
* Support for Python 3.3
Improvements
------------
* Simpler, faster and up-to-date with latest Python code for creating/maintaining interpreter and thread state.
* A much faster WSGI implementation (start_response now implemented in C)
.. _changes_from_3_3_1: .. _changes_from_3_3_1:
Changes from version 3.3.1 Changes from version 3.3.1
......
...@@ -122,13 +122,10 @@ WSGI application which is located in ``/path/to/myapp`` and defined in ...@@ -122,13 +122,10 @@ WSGI application which is located in ``/path/to/myapp`` and defined in
The above example will create a Python-based configuration in The above example will create a Python-based configuration in
``/path/to/new/server_root/conf/http_conf.py`` which is a simple ``/path/to/new/server_root/conf/http_conf.py`` which is a simple
Pythong script. When executed, the output of the script becomes an Python script. When executed, the output of the script becomes an
Apache configuration (``create`` will take care of generating the Apache configuration (``create`` will take care of generating the
first Apache config for you). first Apache config for you).
You should be able to run this Apache instance by executing:: You should be able to run this Apache instance by executing::
mod_python start /path/to/new/server_root/conf/httpd.conf mod_python start /path/to/new/server_root/conf/httpd.conf
...@@ -145,6 +145,7 @@ Every handler can return: ...@@ -145,6 +145,7 @@ Every handler can return:
HTTP_UNSUPPORTED_MEDIA_TYPE = 415 HTTP_UNSUPPORTED_MEDIA_TYPE = 415
HTTP_RANGE_NOT_SATISFIABLE = 416 HTTP_RANGE_NOT_SATISFIABLE = 416
HTTP_EXPECTATION_FAILED = 417 HTTP_EXPECTATION_FAILED = 417
HTTP_IM_A_TEAPOT = 418
HTTP_UNPROCESSABLE_ENTITY = 422 HTTP_UNPROCESSABLE_ENTITY = 422
HTTP_LOCKED = 423 HTTP_LOCKED = 423
HTTP_FAILED_DEPENDENCY = 424 HTTP_FAILED_DEPENDENCY = 424
......
Nov 13 2013 - 3.5.0 released
Oct 22 2013 - 3.4.1 released Oct 22 2013 - 3.4.1 released
Jan 29 2007 - 3.3.1 is being tagged Jan 29 2007 - 3.3.1 is being tagged
......
This diff is collapsed.
...@@ -171,9 +171,7 @@ PyVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version[:3])'`] ...@@ -171,9 +171,7 @@ PyVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version[:3])'`]
PyMAJVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version[:1])'`] PyMAJVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version[:1])'`]
PyMINVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version.split(".")[1])'`] PyMINVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version.split(".")[1])'`]
AC_MSG_RESULT($PyVERSION) AC_MSG_RESULT($PyVERSION)
if test -z "$PyMAJVERSION"; then
AC_MSG_ERROR([Unable to get Python version - is your Python working?])
fi
# make sure Python version is >= 2.6 for 2 and >= 3.3 for 3 # make sure Python version is >= 2.6 for 2 and >= 3.3 for 3
if test "$PyMAJVERSION" -lt "2"; then if test "$PyMAJVERSION" -lt "2"; then
AC_MSG_ERROR([This version of mod_python only works with Python major version 2 or higher. The one you have seems to be $PyVERSION.]) AC_MSG_ERROR([This version of mod_python only works with Python major version 2 or higher. The one you have seems to be $PyVERSION.])
...@@ -217,12 +215,21 @@ if test "${PYTHONFRAMEWORKDIR}" = "no-framework"; then ...@@ -217,12 +215,21 @@ if test "${PYTHONFRAMEWORKDIR}" = "no-framework"; then
standard_lib=1) +"/config")'` standard_lib=1) +"/config")'`
LDFLAGS="${LDFLAGS1} ${LDFLAGS2}" LDFLAGS="${LDFLAGS1} ${LDFLAGS2}"
if test "$PyMAJVERSION" -eq "3"; then PYTHON_CODE=$(cat <<END
PyLDVERSION=`$PYTHON_BIN -c ['from distutils import sysconfig; print(sysconfig.get_config_var("LDVERSION"))'`] import distutils.sysconfig
LDLIBS1="-lpython${PyLDVERSION}" lookingFor = "-lpython"
else ret = str(distutils.sysconfig.get_config_var("BLDLIBRARY"))
LDLIBS1="-lpython${PyVERSION}" if lookingFor not in ret:
fi cfg = distutils.sysconfig.get_config_vars()
for key in cfg:
if isinstance(cfg@<:@key@:>@, str) and lookingFor in cfg@<:@key@:>@:
ret = cfg@<:@key@:>@
break
print(ret@<:@ret.find(lookingFor) if ret.find(lookingFor) != -1 else 0:@:>@)
END
)
LDLIBS1=`${PYTHON_BIN} -c "$PYTHON_CODE"`
LDLIBS2=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ LDLIBS2=`${PYTHON_BIN} -c 'from distutils import sysconfig; \
print(sysconfig.get_config_var("LIBS"))'` print(sysconfig.get_config_var("LIBS"))'`
...@@ -326,9 +333,9 @@ if test "$LEX" && test -x "$LEX"; then ...@@ -326,9 +333,9 @@ if test "$LEX" && test -x "$LEX"; then
AC_MSG_CHECKING(flex version) AC_MSG_CHECKING(flex version)
FlexVERSION=`$LEX --version | sed 's/version//g' | awk '/flex/ {print $2}'` FlexVERSION=`$LEX --version | sed 's/version//g' | awk '/flex/ {print $2}'`
Flex_MAJOR=`echo $FlexVERSION| awk -F . '{print $1}'` Flex_MAJOR=`echo $FlexVERSION| awk -F. '{print $1}'`
Flex_MINOR=`echo $FlexVERSION| awk -F . '{print $2}'` Flex_MINOR=`echo $FlexVERSION| awk -F. '{print $2}'`
Flex_PATCH=`echo $FlexVERSION| awk -F . '{print $3}'` Flex_PATCH=`echo $FlexVERSION| awk -F. '{print $3}'`
if test "$Flex_MAJOR" -eq "2" && test "$Flex_MINOR" -eq "5" && test "$Flex_PATCH" -ge "31"; then if test "$Flex_MAJOR" -eq "2" && test "$Flex_MINOR" -eq "5" && test "$Flex_PATCH" -ge "31"; then
AC_MSG_RESULT([$FlexVERSION. Good]) AC_MSG_RESULT([$FlexVERSION. Good])
......
...@@ -5,6 +5,17 @@ MPV_PATH="`dirname $0`/../src/include/mp_version.h" ...@@ -5,6 +5,17 @@ MPV_PATH="`dirname $0`/../src/include/mp_version.h"
MAJ=`awk '/MP_VERSION_MAJOR/ {print $3}' $MPV_PATH` MAJ=`awk '/MP_VERSION_MAJOR/ {print $3}' $MPV_PATH`
MIN=`awk '/MP_VERSION_MINOR/ {print $3}' $MPV_PATH` MIN=`awk '/MP_VERSION_MINOR/ {print $3}' $MPV_PATH`
PCH=`awk '/MP_VERSION_PATCH/ {print $3}' $MPV_PATH` PCH=`awk '/MP_VERSION_PATCH/ {print $3}' $MPV_PATH`
GIT=`git describe --always`
echo $MAJ.$MIN.$PCH-$GIT # if git exists in path
if type git >/dev/null 2>&1; then
# and we are in a checkout
if git rev-parse 2>/dev/null; then
# but not on a tag (which means this is a release)
if test -z "`git log 'HEAD^!' --format=%d 2>/dev/null | grep 'tag: '`"; then
# append git revision hash to version
GIT="-`git describe --always`"
fi
fi
fi
echo $MAJ.$MIN.$PCH$GIT
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: e64c10f7fbe0674c543acfba636b2bb2
tags: fbb0d17656682115ca4d033fb2f83ba1
=====================
About these documents
=====================
These documents are generated from `reStructuredText`_ sources by `Sphinx`_, a
document processor specifically written for the Python documentation.
.. _reStructuredText: http://docutils.sf.net/rst.html
.. _Sphinx: http://sphinx.pocoo.org/
This diff is collapsed.
.. _cmd:
******************************
Command Line Tool - mod_python
******************************
.. _cmd-overview:
Overview of mod_python command
==============================
mod_python includes a command-line tool named ``mod_python``. The
``mod_python`` command exists to facilitate tasks related to
configuration and management of mod_python.
The general syntax for the command is ``mod_python <subcommand> <arguments>``
where ``<subcommand>`` is a separate tool with its own argument requirements.
.. _cmd-subcommands:
mod_python command line tool sub-commands
=========================================
create
------
``create`` sub-command creates a simple Apache configuration and a
skeleton directory structure necessary for placement of configuration,
logs and content. It is meant to be executed only once per lifetime of
a project.
The configuration generated by ``create`` consists of an
:mod:`httpdconf` based version (in Python) which can then be used to
generate an actual Apache configuration (by using the ``genconfig``
subcommand or simply executing the config files itself). The idea is
that the Apache configuration is always generated and the Python
version is the one meant for editing/adjustments.
The ``create`` subcommand will create the necessary files and
directories if they do not exist, but will not overwrite any existing
files or directories only producing a warning when a file or directory
already exists. It will abort if the Python version of the
configuration file already exists.
``create`` requires a single argument: the distination directory,
Apache ``ServerRoot``.
``create`` has the following command options:
.. cmdoption:: --listen
A string describing the port and optional IP address on which the
server is to listen for incoming requests in the form
``[ip_address:]port`` The argument will be applied to the Apache
``Listen`` directive as is and therefore must be syntactically
compatible with it.
.. cmdoption:: --pythonpath
A colon (``":"``) separate list of paths to be applied to the
:ref:`dir-other-pp` directive.
.. cmdoption:: --pythonhandler
The name of the Python handler to use. Applied to the
:ref:`dir-handlers-ph` directive.
.. cmdoption:: --pythonoption
An option to be specified in the configuration. Multiple options
are alowed. Applied to the :ref:`dir-other-po` directive.
.. _cmd-sub-create-example:
genconfig
---------
This sub-command exists to facilitate re-generation of an Apache
configuration from a Python-based one. All it does is run the script,
but its use is recommended because the mod_python command will execute
the correct version of Python under which mod_python was initially
compiled. Example::
mod_python genconfig /path/to/server_root/httpd_conf.py > /path/to/server_root/httpd.conf
start
-----
Starts an Apache instance. Requires a single argument, the path to
Apache configuration file.
stop
----
Stops an Apache instance (using graceful-stop). Requires a single
argument, the path to Apache configuration file.
restart
-------
Stops an Apache instance (using graceful). Requires a single argument,
the path to Apache configuration file.
version
-------
This sub-command prints out version and location information about
this mod_python installation, the Apache HTTP Server and Python used
when building this mod_python instance.
Example
-------
To create an Apache instance with all the required directories for a
WSGI application which is located in ``/path/to/myapp`` and defined in
``/path/to/myapp/myapp/myapp/wsgi.py``, run the following::
mod_python create /path/to/new/server_root \
--pythonpath=/path/to/my/app \
--pythonhandler=mod_python.wsgi \
--pythonoption="mod_python.wsgi.application myapp.wsgi::application"
The above example will create a Python-based configuration in
``/path/to/new/server_root/conf/http_conf.py`` which is a simple
Pythong script. When executed, the output of the script becomes an
Apache configuration (``create`` will take care of generating the
first Apache config for you).
You should be able to run this Apache instance by executing::
mod_python start /path/to/new/server_root/conf/httpd.conf
%%%%%%%%%%%%%%%%%%%%%%%%%%%
Mod_python Documentation
%%%%%%%%%%%%%%%%%%%%%%%%%%%
This document aims to be the only necessary and authoritative source
of information about mod_python, usable as a comprehensive reference,
a user guide and a tutorial all-in-one.
.. seealso::
`Python Language Web Site <http://www.python.org/>`_
for information on the Python language
`Apache HTTP Server Project Web Site <http://httpd.apache.org/>`_
for information on the Apache server
.. toctree::
introduction.rst
installation.rst
tutorial.rst
pythonapi.rst
directives.rst
handlers.rst
commandline.rst
ssi.rst
changes.rst
license.rst
about.rst
copyright.rst
*********
Copyright
*********
Mod_python and this documentation is:
Copyright © 2000, 2001, 2013 Gregory Trubetskoy
Copyright © 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation
-------
See :ref:`history-and-license` for complete license and permissions information.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.. _introduction:
************
Introduction
************
.. _performance:
Performance
===========
One of the main advantages of mod_python is the increase in
performance over traditional CGI. Below are results of a very crude
test. The test was done on a 1.2GHz Pentium machine running Red Hat
Linux 7.3. `Ab <http://httpd.apache.org/docs-2.0/programs/ab.html>`_
was used to poll 4 kinds of scripts, all of which imported the
standard cgi module (because this is how a typical Python cgi script
begins), then output a single word ``'Hello!'``. The results are
based on 10000 requests with concurrency of 1::
Standard CGI: 23 requests/s
Mod_python cgihandler: 385 requests/s
Mod_python publisher: 476 requests/s
Mod_python handler: 1203 requests/s
.. _apache_api:
Apache HTTP Server API
======================
Apache processes requests in *phases* (i.e. read the request, parse
headers, check access, etc.). Phases are implemented by
functions called *handlers*. Traditionally, handlers are written in C
and compiled into Apache modules. Mod_python provides a way to extend
Apache functionality by writing Apache handlers in Python. For a
detailed description of the Apache request processing process, see the
`Apache Developer Documentation <http://httpd.apache.org/docs/2.4/developer/>`_, as well as the
`Mod_python - Integrating Python with Apache <http://www.modpython.org/python10/>`_
paper.
Currently only a subset of the Apache HTTP Server API is accessible
via mod_python. It was never the goal of the project to provide a 100%
coverage of the API. Rather, mod_python is focused on the most useful
parts of the API and on providing the most "Pythonic" ways of using
it.
.. _intro_other:
Other Features
==============
Mod_python also provides a number features that fall in the category
of web development, e.g. a parser for embedding Python in HTML
(:ref:`pyapi-psp`), a handler that maps URL space into modules and
functions (:ref:`hand-pub`), support for session (:ref:`pyapi-sess`)
and cookie (:ref:`pyapi-cookie`) handling.
.. seealso::
`Apache HTTP Server Developer Documentation <http://httpd.apache.org/docs/2.4/developer/>`_
for HTTP developer information
`Mod_python - Integrating Python with Apache <http://www.modpython.org/python10/>`_
for details on how mod_python interfaces with Apache HTTP Server
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment