[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Migrating unmanaged Python library extension from ‘python-central’ to ‘python-support’



Ben Finney <ben+debian@benfinney.id.au> (14/04/2009):
> As per bug#523965 <URL:http://bugs.debian.org/523965>, I'm attempting
> to migrate the ‘docutils-manpage-writer’ package from using
> ‘python-central’ to using ‘python-support’.

*-writer-manpage, actually.

> Currently (because there is no upstream build system specifically for
> this code) the package needs the following rules:
> 
> =====
> PROGRAM_DIR = usr/bin
> PROGRAM_NAME = rst2man
> WRITERS_DIR = writers
> MANPAGE_WRITER_DIR = usr/share/pyshared/docutils/${WRITERS_DIR}
> 
> […] 
>  
> .PHONY: install
> install: build
>        install -d ${MANPAGE_WRITER_DIR}
>        install -m 644 writers/manpage.py ${MANPAGE_WRITER_DIR}
>        install -d ${PROGRAM_DIR}
>        install -m 755 ${PROGRAM_NAME} ${PROGRAM_DIR}
>        dh --with python_central install
> =====

That would be python-central, according to the manpage.

> I'm not very familiar with using ‘python-support’, so I'm not clear
> what I need to change in these rules. Where do I need to install the
> library files for them to be properly discovered by ‘dh_pysupport’?

Put them into /usr/lib/python*/site-packages, as documented in its
manpage?

I'm attaching a source debdiff with various things that should help you
reach some working package. Note that cleanup isn't perfect yet, and
that I haven't actually tested it (there are some Breaks: against some
of my locally-installed packages). There are some maintainer scripts,
though (see ./debian/docutils-writer-manpage/DEBIAN after build).

Hope this helps.

Mraw,
KiBi.
diff -u docutils-writer-manpage-0.1~svn.r5663/debian/changelog docutils-writer-manpage-0.1~svn.r5663/debian/changelog
--- docutils-writer-manpage-0.1~svn.r5663/debian/changelog
+++ docutils-writer-manpage-0.1~svn.r5663/debian/changelog
@@ -1,3 +1,10 @@
+docutils-writer-manpage (0.1~svn.r5663-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Ben's homework.
+
+ -- Cyril Brulebois <kibi@debian.org>  Tue, 14 Apr 2009 04:09:10 +0200
+
 docutils-writer-manpage (0.1~svn.r5663-3) unstable; urgency=low
 
   * debian/rules:
diff -u docutils-writer-manpage-0.1~svn.r5663/debian/rules docutils-writer-manpage-0.1~svn.r5663/debian/rules
--- docutils-writer-manpage-0.1~svn.r5663/debian/rules
+++ docutils-writer-manpage-0.1~svn.r5663/debian/rules
@@ -12,26 +12,26 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-WRITER_PACKAGE = docutils-writer-manpage
-PROGRAM_PACKAGE = rst2man
-PROGRAM_DIR = usr/bin
-MANPAGE_WRITER_DIR = usr/share/pyshared/docutils/writers
+MANPAGE_WRITER_DIR = usr/lib/$(shell pyversions -d)/site-packages/docutils/writers
 
 RST_SUFFIX = .txt
 MANPAGES = rst2man.1
 
 BYTECODE_SUFFIX = .pyc
-bytecode_files = $(wildcard ${CURDIR}/*${BYTECODE_SUFFIX})
 
 GET_ORIG_SOURCE = $(dir $_)get-orig-source
 
+PLACEHOLDER=output/.placeholder-for-empty-directory
+
 
-.PHONY: build
 build: manpages rst2man
-	touch output/.placeholder-for-empty-directory
+	touch $(PLACEHOLDER)
 	dh build
+	# Manual installation to the proper directory (depends on
+	# pyversions -d's output):
+	install -d $(MANPAGE_WRITER_DIR)
+	install -m 644 writers/manpage.py $(MANPAGE_WRITER_DIR)
 
-.PHONY: manpages
 manpages: ${MANPAGES}
 
 %.1: %${RST_SUFFIX}
@@ -43,26 +43,13 @@
-.PHONY: clean
 clean:
 	dh clean
-	rm -f ${bytecode_files}
+	find -name "*.$(BYTECODE_SUFFIX)" -delete
+	rm -f $(PLACEHOLDER)
+	rm -f $(MANPAGES)
 
-.PHONY: get-orig-source
 get-orig-source:
 	$(GET_ORIG_SOURCE)
 
-.PHONY: install
-install: build
-	install -d ${MANPAGE_WRITER_DIR}
-	install -m 644 writers/manpage.py ${MANPAGE_WRITER_DIR}
-	install -d ${PROGRAM_DIR}
-	install -m 755 rst2man ${PROGRAM_DIR}
-	dh --with python_central install
-
-.PHONY: binary-indep
-binary-indep: build install
-	dh --with python_central binary-indep
+%:
+	dh $@
 
-.PHONY: binary-arch
-binary-arch: build install
-
-.PHONY: binary
-binary: build binary-indep binary-arch
+.PHONY: manpages
diff -u docutils-writer-manpage-0.1~svn.r5663/debian/control docutils-writer-manpage-0.1~svn.r5663/debian/control
--- docutils-writer-manpage-0.1~svn.r5663/debian/control
+++ docutils-writer-manpage-0.1~svn.r5663/debian/control
@@ -5,16 +5,14 @@
 Homepage: http://docutils.sourceforge.net/sandbox/manpage-writer/
 VCS-bzr: http://bzr.debian.org/collab-maint/docutils-writer-manpage/
 Build-Depends: debhelper (>= 7.0.14),
-    python-central (>= 0.6.8),
+    python-support,
     python-docutils
 Standards-Version: 3.8.0
-XS-Python-Version: all
 
 Package: docutils-writer-manpage
 Architecture: all
 Depends: ${misc:Depends}, ${python:Depends},
     python-docutils
-XB-Python-Version: ${python:Versions}
 Description: writer for Docutils that outputs Unix manual pages
  The purpose of the Docutils project is to create a set of tools for
  processing plaintext documentation into useful formats, such as HTML,
@@ -27,7 +25,6 @@
 Architecture: all
 Depends: ${misc:Depends}, ${python:Depends},
     docutils-writer-manpage
-XB-Python-Version: ${python:Versions}
 Description: tool to convert reST documents to Unix manual pages
  The “rst2man” program converts a reStructuredText document (as
  defined by the Docutils project) to a Unix manual page.
diff -u docutils-writer-manpage-0.1~svn.r5663/debian/docutils-writer-manpage.install docutils-writer-manpage-0.1~svn.r5663/debian/docutils-writer-manpage.install
--- docutils-writer-manpage-0.1~svn.r5663/debian/docutils-writer-manpage.install
+++ docutils-writer-manpage-0.1~svn.r5663/debian/docutils-writer-manpage.install
@@ -1 +1 @@
-usr/share/pyshared/docutils/writers/
+usr/lib/python*/site-packages/docutils/writers/
diff -u docutils-writer-manpage-0.1~svn.r5663/debian/rst2man.install docutils-writer-manpage-0.1~svn.r5663/debian/rst2man.install
--- docutils-writer-manpage-0.1~svn.r5663/debian/rst2man.install
+++ docutils-writer-manpage-0.1~svn.r5663/debian/rst2man.install
@@ -1 +1 @@
-usr/bin/rst2man
+rst2man usr/bin
only in patch2:
unchanged:
--- docutils-writer-manpage-0.1~svn.r5663.orig/rst2man
+++ docutils-writer-manpage-0.1~svn.r5663/rst2man
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Author: 
+# Contact: grubert@users.sf.net
+# Copyright: This module has been placed in the public domain.
+
+"""
+man.py
+======
+
+This module provides a simple command line interface that uses the
+man page writer to output from ReStructuredText source.
+"""
+
+import locale
+try:
+    locale.setlocale(locale.LC_ALL, '')
+except:
+    pass
+
+from docutils.core import publish_cmdline, default_description
+from docutils.writers import manpage
+
+description = ("Generates plain man.  " + default_description)
+
+publish_cmdline(writer=manpage.Writer(), description=description)

Attachment: signature.asc
Description: Digital signature


Reply to: