PQM

Merge lp:~jelmer/pqm/distutils into lp:pqm

Proposed by Jelmer Vernooij
Status: Superseded
Proposed branch: lp:~jelmer/pqm/distutils
Merge into: lp:pqm
Diff against target: 385 lines
To merge this branch: bzr merge lp:~jelmer/pqm/distutils
Reviewer Review Type Date Requested Status
Robert Collins Needs Fixing
pqm developers Pending
Review via email: mp+569@code.launchpad.net

This proposal supersedes a proposal from 2008-07-03.

This proposal has been superseded by a proposal from 2009-07-26.

Commit message

Use distutils instead of automake.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote : Posted in a previous version of this proposal

Ok, lets do this.

Some things:
 - need a Makefile, to let:
   make check
   make dist
   make install
work

 - need to port over the BZR_HOME isolation for shell test scripts

I think that that is all that is needed.
bb:tweak, but this isn't bb

review: Disapprove
Revision history for this message
Jelmer Vernooij (jelmer) wrote : Posted in a previous version of this proposal

These things should be fixed now.

Revision history for this message
Tim Penhey (thumper) wrote :

Hi Jelmer,

It seems to me that the new setup version of "make check" does not run the same tests as the old "make check". Either I missed how it runs the external shell scripts, or it is not there.

Tim

Revision history for this message
Tim Penhey (thumper) wrote :

Also the MANIFEST.in file has:
  include bin/pqm-submit-merge
but no
  include bin/pqm

Can you explain to me why?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

setup.py already includes bin/pqm (it's in scripts=) since that's a Python script. pqm-submit-merge is a shell script.

Revision history for this message
Robert Collins (lifeless) wrote :

This drops running the shell tests.

review: Needs Fixing
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

> This drops running the shell tests.
Fixed in the updated branch.

lp:~jelmer/pqm/distutils updated
184. By Jelmer Vernooij

Run shell tests too from ./setup.py test.

185. By Jelmer Vernooij

Merge trunk.

Unmerged revisions

185. By Jelmer Vernooij

Merge trunk.

184. By Jelmer Vernooij

Run shell tests too from ./setup.py test.

183. By Jelmer Vernooij

Update MANIFEST.in for some non-Python files.

182. By Jelmer Vernooij

Install subpackages.

181. By Jelmer Vernooij

Fix dist target, add build target.

180. By Jelmer Vernooij

Only compare mtimes if output file exists.

179. By Jelmer Vernooij

Merge trunk.

178. By Jelmer Vernooij

Merge trunk.

177. By Jelmer Vernooij

Fix support for BZR_HOME.

176. By Jelmer Vernooij

Add current working directory to python path like was done previously.

Updating diff...

An updated diff will be available in a few minutes. Reload to see the changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2008-07-17 02:03:01 +0000
3+++ .bzrignore 2009-03-26 03:50:20 +0000
4@@ -9,5 +9,10 @@
5 autotools/*
6 tests/.gnupg/*
7 twistd.log*
8+build
9+manual.html
10 tests/workdir
11+cm
12 bzr
13+dist
14+MANIFEST
15
16=== added file 'MANIFEST.in'
17--- MANIFEST.in 1970-01-01 00:00:00 +0000
18+++ MANIFEST.in 2009-03-26 03:50:20 +0000
19@@ -0,0 +1,4 @@
20+include manual.xml
21+include manual.html
22+include sample-pqm.conf
23+include bin/pqm-submit-merge
24
25=== added file 'Makefile'
26--- Makefile 1970-01-01 00:00:00 +0000
27+++ Makefile 2009-03-26 03:50:20 +0000
28@@ -0,0 +1,19 @@
29+PYTHON ?= python
30+SETUP = $(PYTHON) setup.py
31+
32+default:: dist
33+
34+check::
35+ $(SETUP) test
36+
37+clean::
38+ $(SETUP) clean
39+
40+build::
41+ $(SETUP) build
42+
43+dist:: clean
44+ $(SETUP) sdist
45+
46+install:
47+ $(SETUP) install
48
49=== removed file 'Makefile.am'
50--- Makefile.am 2008-05-27 09:37:37 +0000
51+++ Makefile.am 1970-01-01 00:00:00 +0000
52@@ -1,38 +0,0 @@
53-# -*- mode: makefile; coding: utf-8 -*-
54-# Copyright © 2003 Colin Walters <walters@debian.org>
55-## arch-tag: Automake rules for toplevel tla-pqm directory
56-
57-AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5 foreign
58-
59-SUBDIRS = tests
60-PYTHONPATH:=$(shell pwd):$(shell pwd)/bzr:$(shell pwd)/bzrtools:$(shell pwd)/cm/lib:$(shell pwd)/pybaz
61-BZR_HOME:=.
62-
63-docdir = $(prefix)/share/doc/@PACKAGE@
64-
65-bin_SCRIPTS=bin/pqm
66-bin_SCRIPTS+=bin/pqm-submit-merge
67-
68-regulardocs_DATA = sample-pqm.conf
69-regulardocsdir = $(docdir)
70-
71-if BUILD_DOCS
72-all-local: manual.html
73-install-data-hook:
74- $(INSTALL) manual.html $(docdir)
75-else
76-install-data-hook:
77- true
78-endif
79-
80-manual.html: $(srcdir)/manual.xml
81- $(XMLTO) xhtml-nochunks $<
82-
83-clean-local:
84- rm -f manual.html
85-
86-check-local:
87- PYTHONPATH=$(PYTHONPATH) BZR_HOME=$(BZR_HOME) trial pqm.tests pqm.ui.tests
88-
89-EXTRA_DIST = autogen.sh $(regulardocs_DATA) manual.xml $(bin_SCRIPTS)
90-
91
92=== removed file 'autogen.sh'
93--- autogen.sh 2007-11-04 19:20:20 +0000
94+++ autogen.sh 1970-01-01 00:00:00 +0000
95@@ -1,67 +0,0 @@
96-#!/bin/sh
97-# arch-tag: script to rerun autotools
98-# Run this to generate all the initial makefiles, etc.
99-
100-srcdir=`dirname $0`
101-test -z "$srcdir" && srcdir=.
102-
103-PKG_NAME="pqm"
104-
105-(test -f $srcdir/configure.ac \
106- && test -f $srcdir/sample-pqm.conf \
107- && test -f $srcdir/bin/pqm) || {
108- echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
109- echo " top-level $PKG_NAME directory"
110- exit 1
111-}
112-
113-DIE=0
114-
115-have_autoconf=false
116-if autoconf --version < /dev/null > /dev/null 2>&1 ; then
117- autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
118- case $autoconf_version in
119- 2.5*|2.6*)
120- have_autoconf=true
121- ;;
122- esac
123-fi
124-if $have_autoconf ; then : ; else
125- echo
126- echo "You must have autoconf installed to compile $PKG_NAME."
127- echo "install the appropriate package for your distribution,"
128- echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
129- DIE=1
130-fi
131-
132-AUTOMAKE=no
133-ACLOCAL=no
134-for VERSION in 1.7 1.8 1.9 1.10
135-do
136- if automake-$VERSION --version < /dev/null > /dev/null 2>&1; then
137- AUTOMAKE=automake-$VERSION
138- ACLOCAL=aclocal-$VERSION
139- fi
140-done
141-
142-if test $AUTOMAKE = no; then
143- echo
144- echo "You must have automake >= 1.7 installed to compile $PROJECT."
145- echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.7.2.tar.gz"
146- echo "(or a newer version if it is available)"
147- DIE=1
148-fi
149-
150-if test "$DIE" -eq 1; then
151- exit 1
152-fi
153-
154-$ACLOCAL
155-$AUTOMAKE -a --foreign
156-autoconf
157-
158-if test -z "$AUTOGEN_SUBDIR_MODE"; then
159- $srcdir/configure --enable-maintainer-mode --enable-debug "$@"
160- echo
161- echo "Now type 'make' to compile $PKG_NAME."
162-fi
163
164=== removed file 'configure.ac'
165--- configure.ac 2008-07-16 16:01:50 +0000
166+++ configure.ac 1970-01-01 00:00:00 +0000
167@@ -1,37 +0,0 @@
168-# -*- coding: utf-8 -*-
169-# Copyright © 2003 Colin Walters <walters@verbum.org>
170-define(arch-tag)
171-# arch-tag: Toplevel Autoconf configuration script
172-
173-AC_INIT(pqm, 0.5)
174-AC_CONFIG_SRCDIR(bin/pqm)
175-AC_CONFIG_AUX_DIR(autotools)
176-AM_INIT_AUTOMAKE
177-
178-AM_MAINTAINER_MODE
179-
180-AC_ARG_ENABLE(docs, AC_HELP_STRING([--disable-docs], [ don't build documentation files using db2html ]))
181-
182-AM_PATH_PYTHON([2.4])
183-
184-if test x$enable_docs != xno ; then
185- AC_PATH_PROG(XMLTO, xmlto, no)
186- if test x$XMLTO = xno && test x$enable_docs = yes; then
187- AC_MSG_ERROR([Building docs explicitly required, but xmlto not found])
188- else
189- AC_MSG_CHECKING([whether to build documentation])
190- if test x$XMLTO = xno; then
191- AC_MSG_RESULT([no])
192- else
193- enable_docs=yes
194- AC_MSG_RESULT(yes)
195- fi
196- fi
197-fi
198-
199-AM_CONDITIONAL(BUILD_DOCS, test x$enable_docs = xyes)
200-
201-AC_OUTPUT([
202-Makefile
203-tests/Makefile
204-])
205
206=== added file 'setup.py'
207--- setup.py 1970-01-01 00:00:00 +0000
208+++ setup.py 2009-03-26 03:50:20 +0000
209@@ -0,0 +1,176 @@
210+#!/usr/bin/python
211+from distutils.core import setup, Command
212+from distutils.command.build import build
213+from distutils.command.install import install
214+from distutils.dist import Distribution
215+from distutils.spawn import find_executable, spawn
216+from distutils import dir_util
217+import os, sys
218+
219+
220+class DocbookDistribution(Distribution):
221+ def __init__(self, attrs=None):
222+ self.docbooks = None
223+ Distribution.__init__(self, attrs)
224+
225+
226+class Trial(Command):
227+ description = "Run unit tests"
228+
229+ user_options = []
230+
231+ def initialize_options(self):
232+ pass
233+
234+ def finalize_options(self):
235+ pass
236+
237+ def get_command_name(self):
238+ return 'test'
239+
240+ def run(self):
241+ import pqm
242+ from twisted.trial.runner import TestLoader, TestSuite, TrialRunner
243+ from twisted.trial.reporter import TreeReporter
244+ runner = TrialRunner(TreeReporter)
245+ loader = TestLoader()
246+ suite = TestSuite()
247+ suite.addTest(loader.loadByName('pqm.tests', True))
248+ suite.addTest(loader.loadByName('pqm.ui.tests', True))
249+ runner.run(suite)
250+
251+
252+class BuildDocbookHTML(Command):
253+ description = "Build Docbook HTML documentation"
254+
255+ user_options = [('xmlto-path=', None, "Path to the xmlto executable")]
256+
257+ def initialize_options(self):
258+ self.xmlto_path = None
259+
260+ def finalize_options(self):
261+ if self.xmlto_path is None:
262+ self.xmlto_path = find_executable("xmlto")
263+ if self.xmlto_path is None:
264+ raise SystemExit("Unable to find 'xmlto', needed to generate Docbook HTML documentation.")
265+
266+ def get_command_name(self):
267+ return 'build_docbook'
268+
269+ def run(self):
270+ for input_file in self.distribution.docbooks:
271+ if not os.path.exists(input_file):
272+ raise SystemExit("File %s is missing." % input_file)
273+
274+ output_file = "%s.html" % (os.path.splitext(input_file)[0])
275+
276+ if (os.path.exists(output_file) and
277+ os.path.getmtime(input_file) < os.path.getmtime(output_file)):
278+ # File is up to date
279+ continue
280+
281+ self.announce("Building Docbook documentation from %s." % input_file)
282+ spawn([self.xmlto_path, "xhtml-nochunks", input_file])
283+
284+
285+class InstallDocbookHTML(Command):
286+ description = "Install Docbook HTML files"
287+
288+ user_options = [
289+ ('install-dir=', 'd',"base directory for installing docbook HTML files"),
290+ ('skip-build', None, "skip the build steps"),
291+ ]
292+
293+ boolean_options = ['skip-build']
294+
295+ def initialize_options(self):
296+ self.install_dir = None
297+ self.prefix = None
298+ self.root = None
299+ self.skip_build = None
300+
301+ def finalize_options(self):
302+ own_install_dir = self.install_dir is not None
303+
304+ self.set_undefined_options('install',
305+ ('skip_build', 'skip_build'),
306+ ('prefix', 'prefix'),
307+ )
308+
309+ if self.install_dir is None:
310+ self.install_dir = os.path.join(self.prefix, "share", "doc",
311+ self.distribution.metadata.name)
312+
313+ if own_install_dir and self.root is not None:
314+ self.install_dir = change_root(self.root, self.installdir)
315+
316+ def get_command_name(self):
317+ return 'install_html'
318+
319+ def run(self):
320+ if not self.skip_build:
321+ self.run_command('build_html')
322+
323+ self.announce("Installing HTML files...")
324+ counter = 0
325+ for input_file in self.distribution.docbooks:
326+ output_file = os.path.splitext(input_file)[0] + ".html"
327+ self.announce("Install Docbook documentation from %s." % input_file)
328+ if not os.path.exists(input_file):
329+ raise SystemExit("File %s is missing." % input_file)
330+ dir_util.mkpath(self.install_dir, 0777, dry_run=self.dry_run)
331+ self.copy_file(output_file, self.install_dir)
332+
333+
334+def has_docbook(build):
335+ return (build.distribution.docbooks is not None and
336+ build.distribution.docbooks != [])
337+
338+
339+class Build(build):
340+ sub_commands = build.sub_commands[:]
341+ sub_commands.append(('build_html', has_docbook))
342+
343+
344+class Install(install):
345+ sub_commands = install.sub_commands[:]
346+ sub_commands.append(('install_html', has_docbook))
347+
348+
349+sys.path = [os.path.join(os.getcwd(), p) for p in [".", "bzr", "bzrtools", "cm/lib"]] + sys.path
350+
351+if "BZR_HOME" in os.environ:
352+ os.environ.insert(0, os.environ["BZR_HOME"])
353+
354+setup(
355+ distclass=DocbookDistribution,
356+ name='pqm',
357+ version='0',
358+ maintainer="Robert Collins",
359+ maintainer_email="robertc@robertcollins.net",
360+ url='http://launchpad.net/pqm',
361+ description='Patch Queue Manager.',
362+ packages=[
363+ 'pqm',
364+ 'pqm.tests',
365+ 'pqm.ui',
366+ 'pqm.ui.tests',
367+ ],
368+ scripts=[
369+ 'bin/pqm',
370+ ],
371+ cmdclass={
372+ 'build': Build,
373+ 'install': Install,
374+ 'build_html': BuildDocbookHTML,
375+ 'install_html': InstallDocbookHTML,
376+ 'test': Trial
377+ },
378+ docbooks=[
379+ 'manual.xml'
380+ ],
381+ data_files=[
382+ ('bin', ['bin/pqm-submit-merge']),
383+ ('share/doc/pqm', ['sample-pqm.conf'])
384+ ]
385+)

Subscribers

People subscribed via source and target branches

to status/vote changes: