Sat Jan 18 20:17:10 2014 UTC ()
Update Python section and document versioned_dependencies.mk.


(wiz)
diff -r1.14 -r1.15 pkgsrc/doc/guide/files/creating.xml

cvs diff -r1.14 -r1.15 pkgsrc/doc/guide/files/creating.xml (expand / switch to unified diff)

--- pkgsrc/doc/guide/files/creating.xml 2014/01/12 09:43:30 1.14
+++ pkgsrc/doc/guide/files/creating.xml 2014/01/18 20:17:10 1.15
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1<!-- $NetBSD: creating.xml,v 1.14 2014/01/12 09:43:30 wiz Exp $ --> 1<!-- $NetBSD: creating.xml,v 1.15 2014/01/18 20:17:10 wiz Exp $ -->
2 2
3<chapter id="creating"> 3<chapter id="creating">
4<title>Creating a new pkgsrc package from scratch</title> 4<title>Creating a new pkgsrc package from scratch</title>
5 5
6<para>When you find a package that is not yet in pkgsrc, you 6<para>When you find a package that is not yet in pkgsrc, you
7most likely have a URL from where you can download the source 7most likely have a URL from where you can download the source
8code. Starting with this URL, creating a package involves only a 8code. Starting with this URL, creating a package involves only a
9few steps.</para> 9few steps.</para>
10 10
11<procedure> 11<procedure>
12 12
13<step><para>First, install the packages <filename 13<step><para>First, install the packages <filename
14role="pkg">pkgtools/url2pkg</filename> and <filename 14role="pkg">pkgtools/url2pkg</filename> and <filename
@@ -126,72 +126,82 @@ package from the set of installed files. @@ -126,72 +126,82 @@ package from the set of installed files.
126 126
127<para>KDE applications should always include 127<para>KDE applications should always include
128<filename>meta-pkgs/kde3/kde3.mk</filename>, which contains numerous 128<filename>meta-pkgs/kde3/kde3.mk</filename>, which contains numerous
129settings that are typical of KDE packages.</para> 129settings that are typical of KDE packages.</para>
130 130
131</sect2> 131</sect2>
132 132
133<sect2 id="creating.python-module"> 133<sect2 id="creating.python-module">
134<title>Python modules and programs</title> 134<title>Python modules and programs</title>
135 135
136<para>Python modules and programs packages are easily created using a 136<para>Python modules and programs packages are easily created using a
137set of predefined variables.</para> 137set of predefined variables.</para>
138 138
139<para>Most Python packages use either <quote>distutils</quote> or 
140easy-setup (<quote>eggs</quote>). 
141If the software uses <quote>distutils</quote>, set the 
142<varname>PYDISTUTILSPKG</varname> variable to <quote>yes</quote> so 
143pkgsrc will make use of this framework. 
144<quote>distutils</quote> uses a script called <filename>setup.py</filename>, 
145if the <quote>distutils</quote> driver is not called 
146<filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable 
147to the name of the script.</para> 
148 
149<para> 139<para>
150If the default Python versions are not supported by the software, set the 140If some Python versions are not supported by the software, set the
151<varname>PYTHON_VERSIONS_ACCEPTED</varname> variable to the Python versions 141<varname>PYTHON_VERSIONS_INCOMPATIBLE</varname> variable to the Python versions
152the software is known to work with, from the most recent to the older 142that are not supported, e.g.
153one, e.g. 
154<programlisting> 143<programlisting>
155PYTHON_VERSIONS_ACCEPTED= 33 27 26 144PYTHON_VERSIONS_ACCEPTED= 26
156</programlisting></para> 145</programlisting></para>
157 146
158<para> 147<para>
159If the packaged software is a Python module, include 148If the packaged software is a Python module, include
160<quote><filename>../../lang/python/extension.mk</filename></quote>. 149<quote><filename>../../lang/python/extension.mk</filename></quote>.
161In this case, the package directory should be called 150In this case, the package directory should be called
162<quote>py-software</quote> and <varname>PKGNAME</varname> should be set to 151<quote>py-software</quote> and <varname>PKGNAME</varname> should be set to
163<quote>${PYPKGPREFIX}-${DISTNAME}</quote>, e.g. 152<quote>${PYPKGPREFIX}-${DISTNAME}</quote>, e.g.
164<programlisting> 153<programlisting>
165DISTNAME= foopymodule-1.2.10 154DISTNAME= foopymodule-1.2.10
166PKGNAME= ${PYPKGPREFIX}-${DISTNAME} 155PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
167</programlisting></para> 156</programlisting></para>
168 157
169<para>If it is an application, also include 158<para>If it is an application, include
170<quote><filename>../../lang/python/application.mk</filename></quote> 159<quote><filename>../../lang/python/application.mk</filename></quote>.
171before <quote>extension.mk</quote>.</para> 160In order to correctly set the path to the Python interpreter, use the
172 
173<para>If the packaged software, either it is an application or a module, is 
174egg-aware, you only need to include 
175<quote><filename>../../lang/python/egg.mk</filename></quote>.</para> 
176 
177<para>In order to correctly set the path to the Python interpreter, use the 
178<varname>REPLACE_PYTHON</varname> variable and set it to the list of files 161<varname>REPLACE_PYTHON</varname> variable and set it to the list of files
179(paths relative to <varname>WRKSRC</varname>) that must be corrected. 162(paths relative to <varname>WRKSRC</varname>) that must be corrected.
180For example : 163For example:
181<programlisting> 164<programlisting>
182REPLACE_PYTHON= *.py 165REPLACE_PYTHON= *.py
183</programlisting></para> 166</programlisting></para>
184 167
 168<para>Most Python packages use either <quote>distutils</quote> or
 169easy-setup (<quote>eggs</quote>).
 170If the software uses <quote>distutils</quote>, include
 171<quote><filename>../../lang/python/distutils.mk</filename></quote>.
 172so pkgsrc will use this framework.
 173<quote>distutils</quote> uses a script called <filename>setup.py</filename>,
 174if the <quote>distutils</quote> driver is not called
 175<filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable
 176to the name of the script.</para>
 177
 178<para>Otherwise, if the packaged software is egg-aware, you only need
 179to include
 180<quote><filename>../../lang/python/egg.mk</filename></quote>.</para>
 181
 182<para>Some Python modules have separate distributions for Python-2.x
 183and Python-3.x support. In pkgsrc this is handled by the
 184<filename>versioned_dependencies.mk</filename> file. Set
 185<varname>PYTHON_VERSIONED_DEPENDENCIES</varname> to the list of
 186packages that should be depended upon and include
 187<quote><filename>../../lang/python/versioned_dependencies.mk</filename></quote>,
 188then the pkgsrc infrastructure will depend on the appropriate package
 189version. For example:
 190<programlisting>
 191PYTHON_VERSIONED_DEPENDENCIES=dateutil dns
 192</programlisting>
 193Look inside <filename>versioned_dependencies.mk</filename> for a list
 194of supported packages.</para>
185</sect2> 195</sect2>
186 196
187</sect1> 197</sect1>
188 198
189<sect1 id="creating.examples"> 199<sect1 id="creating.examples">
190<title>Examples</title> 200<title>Examples</title>
191 201
192<sect2 id="creating.nvu"> 202<sect2 id="creating.nvu">
193<title>How the www/nvu package came into pkgsrc</title> 203<title>How the www/nvu package came into pkgsrc</title>
194 204
195<sect3 id="creating.nvu.init"> 205<sect3 id="creating.nvu.init">
196<title>The initial package</title> 206<title>The initial package</title>
197 207