PQM

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

Proposed by Jelmer Vernooij
Status: Rejected
Rejected by: Robert Collins
Proposed branch: lp:~jelmer/pqm/distutils
Merge into: lp:pqm
Diff against target: None lines
To merge this branch: bzr merge lp:~jelmer/pqm/distutils

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

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

This drops running the shell tests.

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

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

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 2008-07-27 03:04:53 +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 2008-07-27 03:04:53 +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 2008-07-27 02:58:54 +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-05-02 18:44:20 +0000
209@@ -0,0 +1,192 @@
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_python_tests(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+ def _run_shell_tests(self):
252+ SHELL_TESTS = ["simple-submit-1", "simple-submit-2",
253+ "simple-submit-3", "simple-patch-1",
254+ "simple-patch-2", "simple-merge-1",
255+ "simple-merge-2", "simple-merge-3",
256+ "simple-merge-4", "bzr-merge"]
257+ shelltest_dir = os.path.join(os.path.dirname(__file__), "tests")
258+ os.putenv("srcdir", shelltest_dir)
259+ for test in SHELL_TESTS:
260+ if os.system("./%s/%s.sh" % (shelltest_dir, test)) != 0:
261+ self.announce("Shell test %s failed" % test)
262+
263+ def run(self):
264+ self._run_python_tests()
265+ self._run_shell_tests()
266+
267+
268+class BuildDocbookHTML(Command):
269+ description = "Build Docbook HTML documentation"
270+
271+ user_options = [('xmlto-path=', None, "Path to the xmlto executable")]
272+
273+ def initialize_options(self):
274+ self.xmlto_path = None
275+
276+ def finalize_options(self):
277+ if self.xmlto_path is None:
278+ self.xmlto_path = find_executable("xmlto")
279+ if self.xmlto_path is None:
280+ raise SystemExit("Unable to find 'xmlto', needed to generate Docbook HTML documentation.")
281+
282+ def get_command_name(self):
283+ return 'build_docbook'
284+
285+ def run(self):
286+ for input_file in self.distribution.docbooks:
287+ if not os.path.exists(input_file):
288+ raise SystemExit("File %s is missing." % input_file)
289+
290+ output_file = "%s.html" % (os.path.splitext(input_file)[0])
291+
292+ if (os.path.exists(output_file) and
293+ os.path.getmtime(input_file) < os.path.getmtime(output_file)):
294+ # File is up to date
295+ continue
296+
297+ self.announce("Building Docbook documentation from %s." % input_file)
298+ spawn([self.xmlto_path, "xhtml-nochunks", input_file])
299+
300+
301+class InstallDocbookHTML(Command):
302+ description = "Install Docbook HTML files"
303+
304+ user_options = [
305+ ('install-dir=', 'd',"base directory for installing docbook HTML files"),
306+ ('skip-build', None, "skip the build steps"),
307+ ]
308+
309+ boolean_options = ['skip-build']
310+
311+ def initialize_options(self):
312+ self.install_dir = None
313+ self.prefix = None
314+ self.root = None
315+ self.skip_build = None
316+
317+ def finalize_options(self):
318+ own_install_dir = self.install_dir is not None
319+
320+ self.set_undefined_options('install',
321+ ('skip_build', 'skip_build'),
322+ ('prefix', 'prefix'),
323+ )
324+
325+ if self.install_dir is None:
326+ self.install_dir = os.path.join(self.prefix, "share", "doc",
327+ self.distribution.metadata.name)
328+
329+ if own_install_dir and self.root is not None:
330+ self.install_dir = change_root(self.root, self.installdir)
331+
332+ def get_command_name(self):
333+ return 'install_html'
334+
335+ def run(self):
336+ if not self.skip_build:
337+ self.run_command('build_html')
338+
339+ self.announce("Installing HTML files...")
340+ counter = 0
341+ for input_file in self.distribution.docbooks:
342+ output_file = os.path.splitext(input_file)[0] + ".html"
343+ self.announce("Install Docbook documentation from %s." % input_file)
344+ if not os.path.exists(input_file):
345+ raise SystemExit("File %s is missing." % input_file)
346+ dir_util.mkpath(self.install_dir, 0777, dry_run=self.dry_run)
347+ self.copy_file(output_file, self.install_dir)
348+
349+
350+def has_docbook(build):
351+ return (build.distribution.docbooks is not None and
352+ build.distribution.docbooks != [])
353+
354+
355+class Build(build):
356+ sub_commands = build.sub_commands[:]
357+ sub_commands.append(('build_html', has_docbook))
358+
359+
360+class Install(install):
361+ sub_commands = install.sub_commands[:]
362+ sub_commands.append(('install_html', has_docbook))
363+
364+
365+sys.path = [os.path.join(os.getcwd(), p) for p in [".", "bzr", "bzrtools", "cm/lib"]] + sys.path
366+
367+if "BZR_HOME" in os.environ:
368+ os.environ.insert(0, os.environ["BZR_HOME"])
369+
370+setup(
371+ distclass=DocbookDistribution,
372+ name='pqm',
373+ version='0',
374+ maintainer="Robert Collins",
375+ maintainer_email="robertc@robertcollins.net",
376+ url='http://launchpad.net/pqm',
377+ description='Patch Queue Manager.',
378+ packages=[
379+ 'pqm',
380+ 'pqm.tests',
381+ 'pqm.ui',
382+ 'pqm.ui.tests',
383+ ],
384+ scripts=[
385+ 'bin/pqm',
386+ ],
387+ cmdclass={
388+ 'build': Build,
389+ 'install': Install,
390+ 'build_html': BuildDocbookHTML,
391+ 'install_html': InstallDocbookHTML,
392+ 'test': Trial
393+ },
394+ docbooks=[
395+ 'manual.xml'
396+ ],
397+ data_files=[
398+ ('bin', ['bin/pqm-submit-merge']),
399+ ('share/doc/pqm', ['sample-pqm.conf'])
400+ ]
401+)
402
403=== removed file 'tests/Makefile.am'
404--- tests/Makefile.am 2005-12-19 08:02:19 +0000
405+++ tests/Makefile.am 1970-01-01 00:00:00 +0000
406@@ -1,23 +0,0 @@
407-## -*- mode: makefile; coding: utf-8 -*-
408-## Copyright © 2003,2004 Colin Walters <walters@verbum.org>
409-## arch-tag: Automake rules for the tla-pqm tests
410-## See the file "COPYING" for further information about
411-## the copyright and warranty status of this work.
412-
413-TESTS = $(srcdir)/simple-submit-1.sh \
414- $(srcdir)/simple-submit-2.sh \
415- $(srcdir)/simple-submit-3.sh \
416- $(srcdir)/simple-patch-1.sh \
417- $(srcdir)/simple-patch-2.sh \
418- $(srcdir)/simple-merge-1.sh \
419- $(srcdir)/simple-merge-2.sh \
420- $(srcdir)/simple-merge-3.sh \
421- $(srcdir)/simple-merge-4.sh \
422- $(srcdir)/bzr-merge.sh
423-
424-EXTRA_DIST = test-framework pqm-tests.conf pqm-tests-2.conf \
425- pqm-tests-3.conf pqm-tests-4.conf \
426- pqm-tests-5.conf \
427- .gnupg/gpg.conf .gnupg/pubring.gpg \
428- .gnupg/secring.gpg $(TESTS)
429-

Subscribers

People subscribed via source and target branches

to status/vote changes: