| @@ -5343,70 +5343,57 @@ left to do. | | | @@ -5343,70 +5343,57 @@ left to do. |
5343 | <a name="creating.python-module"></a>14.1.1. Python modules and programs</h3></div></div></div> | | 5343 | <a name="creating.python-module"></a>14.1.1. Python modules and programs</h3></div></div></div> |
5344 | <p>Python modules and programs packages are easily created using a | | 5344 | <p>Python modules and programs packages are easily created using a |
5345 | set of predefined variables.</p> | | 5345 | set of predefined variables.</p> |
5346 | <p> | | 5346 | <p> |
5347 | If some Python versions are not supported by the software, set the | | 5347 | If some Python versions are not supported by the software, set the |
5348 | <code class="varname">PYTHON_VERSIONS_INCOMPATIBLE</code> variable to the Python versions | | 5348 | <code class="varname">PYTHON_VERSIONS_INCOMPATIBLE</code> variable to the Python versions |
5349 | that are not supported, e.g. | | 5349 | that are not supported, e.g. |
5350 | </p> | | 5350 | </p> |
5351 | <pre class="programlisting"> | | 5351 | <pre class="programlisting"> |
5352 | PYTHON_VERSIONS_INCOMPATIBLE= 27 | | 5352 | PYTHON_VERSIONS_INCOMPATIBLE= 27 |
5353 | </pre> | | 5353 | </pre> |
5354 | <p> | | 5354 | <p> |
5355 | If the packaged software is a Python module, include | | 5355 | If the packaged software is a Python module, include |
5356 | <code class="filename">../../lang/python/wheel.mk</code>. | | 5356 | <code class="filename">../../lang/python/wheel.mk</code>. Note per PEP-518, |
5357 | Note per PEP-518, the minimum and default requirements to create .whl files | | 5357 | the minimum and default requirements to create .whl files are |
5358 | are py-setuptools plus py-wheel; however, there are various other possible | | 5358 | <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/py-setuptools/index.html" target="_top"><code class="filename">devel/py-setuptools</code></a> plus <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/py-wheel/index.html" target="_top"><code class="filename">devel/py-wheel</code></a>; however, there are various other |
5359 | tools that projects can use. Thus inclusion of <code class="filename">wheel.mk</code> | | 5359 | possible tools that projects can use. Thus inclusion of |
5360 | does not imply these defaults are defined as TOOL_DEPENDS. Whatever the project | | 5360 | <code class="filename">wheel.mk</code> does not imply these defaults are |
5361 | specifically requires as packaging tools must be defined in the package Makefile. | | 5361 | defined as <code class="varname">TOOL_DEPENDS</code>. Whatever the project |
| | | 5362 | specifically requires as packaging tools must be defined in the |
| | | 5363 | package Makefile. |
5362 | </p> | | 5364 | </p> |
5363 | <p>The package directory should be called | | 5365 | <p>The package directory should be called |
5364 | <span class="quote">“<span class="quote">py-software</span>”</span> and <code class="varname">PKGNAME</code> should be set to | | 5366 | <span class="quote">“<span class="quote">py-software</span>”</span> and <code class="varname">PKGNAME</code> should be set to |
5365 | <span class="quote">“<span class="quote">${PYPKGPREFIX}-${DISTNAME}</span>”</span>, e.g. | | 5367 | <span class="quote">“<span class="quote">${PYPKGPREFIX}-${DISTNAME}</span>”</span>, e.g. |
5366 | </p> | | 5368 | </p> |
5367 | <pre class="programlisting"> | | 5369 | <pre class="programlisting"> |
5368 | DISTNAME= foopymodule-1.2.10 | | 5370 | DISTNAME= foopymodule-1.2.10 |
5369 | PKGNAME= ${PYPKGPREFIX}-${DISTNAME} | | 5371 | PKGNAME= ${PYPKGPREFIX}-${DISTNAME} |
5370 | </pre> | | 5372 | </pre> |
5371 | <p> | | 5373 | <p> |
5372 | For software in PyPi, the name should match what PyPi specifies for | | 5374 | For software in PyPi, the name should match what PyPi specifies for |
5373 | "pip install software". | | 5375 | "pip install software". |
5374 | </p> | | 5376 | </p> |
5375 | <p>If it is an application, include | | 5377 | <p>If it is an application, include |
5376 | <span class="quote">“<span class="quote"><code class="filename">../../lang/python/application.mk</code></span>”</span>. | | 5378 | <span class="quote">“<span class="quote"><code class="filename">../../lang/python/application.mk</code></span>”</span>. |
5377 | In order to correctly set the path to the Python interpreter, use the | | 5379 | In order to correctly set the path to the Python interpreter, use the |
5378 | <code class="varname">REPLACE_PYTHON</code> variable and set it to the list of files | | 5380 | <code class="varname">REPLACE_PYTHON</code> variable and set it to the list of files |
5379 | (paths relative to <code class="varname">WRKSRC</code>) that must be corrected. | | 5381 | (paths relative to <code class="varname">WRKSRC</code>) that must be corrected. |
5380 | For example: | | 5382 | For example: |
5381 | </p> | | 5383 | </p> |
5382 | <pre class="programlisting"> | | 5384 | <pre class="programlisting"> |
5383 | REPLACE_PYTHON= *.py | | 5385 | REPLACE_PYTHON= *.py |
5384 | </pre> | | 5386 | </pre> |
5385 | <p>Some Python modules have separate distributions for Python-2.x | | | |
5386 | and Python-3.x support. In pkgsrc this is handled by the | | | |
5387 | <code class="filename">versioned_dependencies.mk</code> file. Set | | | |
5388 | <code class="varname">PYTHON_VERSIONED_DEPENDENCIES</code> to the list of | | | |
5389 | packages that should be depended upon and include | | | |
5390 | <span class="quote">“<span class="quote"><code class="filename">../../lang/python/versioned_dependencies.mk</code></span>”</span>, | | | |
5391 | then the pkgsrc infrastructure will depend on the appropriate package | | | |
5392 | version. For example: | | | |
5393 | </p> | | | |
5394 | <pre class="programlisting"> | | | |
5395 | PYTHON_VERSIONED_DEPENDENCIES=dialog | | | |
5396 | </pre> | | | |
5397 | <p> | | | |
5398 | Look inside <code class="filename">versioned_dependencies.mk</code> for a list | | | |
5399 | of supported packages.</p> | | | |
5400 | </div> | | 5387 | </div> |
5401 | <div class="sect2"> | | 5388 | <div class="sect2"> |
5402 | <div class="titlepage"><div><div><h3 class="title"> | | 5389 | <div class="titlepage"><div><div><h3 class="title"> |
5403 | <a name="creating.R-package"></a>14.1.2. R packages</h3></div></div></div> | | 5390 | <a name="creating.R-package"></a>14.1.2. R packages</h3></div></div></div> |
5404 | <p>Simple R packages from <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a> | | 5391 | <p>Simple R packages from <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a> |
5405 | are handled automatically by <span class="command"><strong>R2pkg</strong></span>, which is | | 5392 | are handled automatically by <span class="command"><strong>R2pkg</strong></span>, which is |
5406 | available in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/R2pkg/index.html" target="_top"><code class="filename">pkgtools/R2pkg</code></a>. | | 5393 | available in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/R2pkg/index.html" target="_top"><code class="filename">pkgtools/R2pkg</code></a>. |
5407 | Individual packages (and optionally their dependencies) may be created | | 5394 | Individual packages (and optionally their dependencies) may be created |
5408 | and updated. R packages generally follow the same form, and most of | | 5395 | and updated. R packages generally follow the same form, and most of |
5409 | the relevant information needed is contained in a | | 5396 | the relevant information needed is contained in a |
5410 | <code class="filename">DESCRIPTION</code> file as part of each R package on | | 5397 | <code class="filename">DESCRIPTION</code> file as part of each R package on |
5411 | <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a>. | | 5398 | <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a>. |
5412 | Consequently, <span class="command"><strong>R2pkg</strong></span> downloads that information and | | 5399 | Consequently, <span class="command"><strong>R2pkg</strong></span> downloads that information and |