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
=== modified file '.bzrignore'
--- .bzrignore 2008-07-17 02:03:01 +0000
+++ .bzrignore 2009-03-26 03:50:20 +0000
@@ -9,5 +9,10 @@
9autotools/*9autotools/*
10tests/.gnupg/*10tests/.gnupg/*
11twistd.log*11twistd.log*
12build
13manual.html
12tests/workdir14tests/workdir
15cm
13bzr16bzr
17dist
18MANIFEST
1419
=== added file 'MANIFEST.in'
--- MANIFEST.in 1970-01-01 00:00:00 +0000
+++ MANIFEST.in 2009-03-26 03:50:20 +0000
@@ -0,0 +1,4 @@
1include manual.xml
2include manual.html
3include sample-pqm.conf
4include bin/pqm-submit-merge
05
=== added file 'Makefile'
--- Makefile 1970-01-01 00:00:00 +0000
+++ Makefile 2009-03-26 03:50:20 +0000
@@ -0,0 +1,19 @@
1PYTHON ?= python
2SETUP = $(PYTHON) setup.py
3
4default:: dist
5
6check::
7 $(SETUP) test
8
9clean::
10 $(SETUP) clean
11
12build::
13 $(SETUP) build
14
15dist:: clean
16 $(SETUP) sdist
17
18install:
19 $(SETUP) install
020
=== removed file 'Makefile.am'
--- Makefile.am 2008-05-27 09:37:37 +0000
+++ Makefile.am 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1# -*- mode: makefile; coding: utf-8 -*-
2# Copyright © 2003 Colin Walters <walters@debian.org>
3## arch-tag: Automake rules for toplevel tla-pqm directory
4
5AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5 foreign
6
7SUBDIRS = tests
8PYTHONPATH:=$(shell pwd):$(shell pwd)/bzr:$(shell pwd)/bzrtools:$(shell pwd)/cm/lib:$(shell pwd)/pybaz
9BZR_HOME:=.
10
11docdir = $(prefix)/share/doc/@PACKAGE@
12
13bin_SCRIPTS=bin/pqm
14bin_SCRIPTS+=bin/pqm-submit-merge
15
16regulardocs_DATA = sample-pqm.conf
17regulardocsdir = $(docdir)
18
19if BUILD_DOCS
20all-local: manual.html
21install-data-hook:
22 $(INSTALL) manual.html $(docdir)
23else
24install-data-hook:
25 true
26endif
27
28manual.html: $(srcdir)/manual.xml
29 $(XMLTO) xhtml-nochunks $<
30
31clean-local:
32 rm -f manual.html
33
34check-local:
35 PYTHONPATH=$(PYTHONPATH) BZR_HOME=$(BZR_HOME) trial pqm.tests pqm.ui.tests
36
37EXTRA_DIST = autogen.sh $(regulardocs_DATA) manual.xml $(bin_SCRIPTS)
38
390
=== removed file 'autogen.sh'
--- autogen.sh 2007-11-04 19:20:20 +0000
+++ autogen.sh 1970-01-01 00:00:00 +0000
@@ -1,67 +0,0 @@
1#!/bin/sh
2# arch-tag: script to rerun autotools
3# Run this to generate all the initial makefiles, etc.
4
5srcdir=`dirname $0`
6test -z "$srcdir" && srcdir=.
7
8PKG_NAME="pqm"
9
10(test -f $srcdir/configure.ac \
11 && test -f $srcdir/sample-pqm.conf \
12 && test -f $srcdir/bin/pqm) || {
13 echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
14 echo " top-level $PKG_NAME directory"
15 exit 1
16}
17
18DIE=0
19
20have_autoconf=false
21if autoconf --version < /dev/null > /dev/null 2>&1 ; then
22 autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
23 case $autoconf_version in
24 2.5*|2.6*)
25 have_autoconf=true
26 ;;
27 esac
28fi
29if $have_autoconf ; then : ; else
30 echo
31 echo "You must have autoconf installed to compile $PKG_NAME."
32 echo "install the appropriate package for your distribution,"
33 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
34 DIE=1
35fi
36
37AUTOMAKE=no
38ACLOCAL=no
39for VERSION in 1.7 1.8 1.9 1.10
40do
41 if automake-$VERSION --version < /dev/null > /dev/null 2>&1; then
42 AUTOMAKE=automake-$VERSION
43 ACLOCAL=aclocal-$VERSION
44 fi
45done
46
47if test $AUTOMAKE = no; then
48 echo
49 echo "You must have automake >= 1.7 installed to compile $PROJECT."
50 echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.7.2.tar.gz"
51 echo "(or a newer version if it is available)"
52 DIE=1
53fi
54
55if test "$DIE" -eq 1; then
56 exit 1
57fi
58
59$ACLOCAL
60$AUTOMAKE -a --foreign
61autoconf
62
63if test -z "$AUTOGEN_SUBDIR_MODE"; then
64 $srcdir/configure --enable-maintainer-mode --enable-debug "$@"
65 echo
66 echo "Now type 'make' to compile $PKG_NAME."
67fi
680
=== removed file 'configure.ac'
--- configure.ac 2008-07-16 16:01:50 +0000
+++ configure.ac 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
1# -*- coding: utf-8 -*-
2# Copyright © 2003 Colin Walters <walters@verbum.org>
3define(arch-tag)
4# arch-tag: Toplevel Autoconf configuration script
5
6AC_INIT(pqm, 0.5)
7AC_CONFIG_SRCDIR(bin/pqm)
8AC_CONFIG_AUX_DIR(autotools)
9AM_INIT_AUTOMAKE
10
11AM_MAINTAINER_MODE
12
13AC_ARG_ENABLE(docs, AC_HELP_STRING([--disable-docs], [ don't build documentation files using db2html ]))
14
15AM_PATH_PYTHON([2.4])
16
17if test x$enable_docs != xno ; then
18 AC_PATH_PROG(XMLTO, xmlto, no)
19 if test x$XMLTO = xno && test x$enable_docs = yes; then
20 AC_MSG_ERROR([Building docs explicitly required, but xmlto not found])
21 else
22 AC_MSG_CHECKING([whether to build documentation])
23 if test x$XMLTO = xno; then
24 AC_MSG_RESULT([no])
25 else
26 enable_docs=yes
27 AC_MSG_RESULT(yes)
28 fi
29 fi
30fi
31
32AM_CONDITIONAL(BUILD_DOCS, test x$enable_docs = xyes)
33
34AC_OUTPUT([
35Makefile
36tests/Makefile
37])
380
=== added file 'setup.py'
--- setup.py 1970-01-01 00:00:00 +0000
+++ setup.py 2009-03-26 03:50:20 +0000
@@ -0,0 +1,176 @@
1#!/usr/bin/python
2from distutils.core import setup, Command
3from distutils.command.build import build
4from distutils.command.install import install
5from distutils.dist import Distribution
6from distutils.spawn import find_executable, spawn
7from distutils import dir_util
8import os, sys
9
10
11class DocbookDistribution(Distribution):
12 def __init__(self, attrs=None):
13 self.docbooks = None
14 Distribution.__init__(self, attrs)
15
16
17class Trial(Command):
18 description = "Run unit tests"
19
20 user_options = []
21
22 def initialize_options(self):
23 pass
24
25 def finalize_options(self):
26 pass
27
28 def get_command_name(self):
29 return 'test'
30
31 def run(self):
32 import pqm
33 from twisted.trial.runner import TestLoader, TestSuite, TrialRunner
34 from twisted.trial.reporter import TreeReporter
35 runner = TrialRunner(TreeReporter)
36 loader = TestLoader()
37 suite = TestSuite()
38 suite.addTest(loader.loadByName('pqm.tests', True))
39 suite.addTest(loader.loadByName('pqm.ui.tests', True))
40 runner.run(suite)
41
42
43class BuildDocbookHTML(Command):
44 description = "Build Docbook HTML documentation"
45
46 user_options = [('xmlto-path=', None, "Path to the xmlto executable")]
47
48 def initialize_options(self):
49 self.xmlto_path = None
50
51 def finalize_options(self):
52 if self.xmlto_path is None:
53 self.xmlto_path = find_executable("xmlto")
54 if self.xmlto_path is None:
55 raise SystemExit("Unable to find 'xmlto', needed to generate Docbook HTML documentation.")
56
57 def get_command_name(self):
58 return 'build_docbook'
59
60 def run(self):
61 for input_file in self.distribution.docbooks:
62 if not os.path.exists(input_file):
63 raise SystemExit("File %s is missing." % input_file)
64
65 output_file = "%s.html" % (os.path.splitext(input_file)[0])
66
67 if (os.path.exists(output_file) and
68 os.path.getmtime(input_file) < os.path.getmtime(output_file)):
69 # File is up to date
70 continue
71
72 self.announce("Building Docbook documentation from %s." % input_file)
73 spawn([self.xmlto_path, "xhtml-nochunks", input_file])
74
75
76class InstallDocbookHTML(Command):
77 description = "Install Docbook HTML files"
78
79 user_options = [
80 ('install-dir=', 'd',"base directory for installing docbook HTML files"),
81 ('skip-build', None, "skip the build steps"),
82 ]
83
84 boolean_options = ['skip-build']
85
86 def initialize_options(self):
87 self.install_dir = None
88 self.prefix = None
89 self.root = None
90 self.skip_build = None
91
92 def finalize_options(self):
93 own_install_dir = self.install_dir is not None
94
95 self.set_undefined_options('install',
96 ('skip_build', 'skip_build'),
97 ('prefix', 'prefix'),
98 )
99
100 if self.install_dir is None:
101 self.install_dir = os.path.join(self.prefix, "share", "doc",
102 self.distribution.metadata.name)
103
104 if own_install_dir and self.root is not None:
105 self.install_dir = change_root(self.root, self.installdir)
106
107 def get_command_name(self):
108 return 'install_html'
109
110 def run(self):
111 if not self.skip_build:
112 self.run_command('build_html')
113
114 self.announce("Installing HTML files...")
115 counter = 0
116 for input_file in self.distribution.docbooks:
117 output_file = os.path.splitext(input_file)[0] + ".html"
118 self.announce("Install Docbook documentation from %s." % input_file)
119 if not os.path.exists(input_file):
120 raise SystemExit("File %s is missing." % input_file)
121 dir_util.mkpath(self.install_dir, 0777, dry_run=self.dry_run)
122 self.copy_file(output_file, self.install_dir)
123
124
125def has_docbook(build):
126 return (build.distribution.docbooks is not None and
127 build.distribution.docbooks != [])
128
129
130class Build(build):
131 sub_commands = build.sub_commands[:]
132 sub_commands.append(('build_html', has_docbook))
133
134
135class Install(install):
136 sub_commands = install.sub_commands[:]
137 sub_commands.append(('install_html', has_docbook))
138
139
140sys.path = [os.path.join(os.getcwd(), p) for p in [".", "bzr", "bzrtools", "cm/lib"]] + sys.path
141
142if "BZR_HOME" in os.environ:
143 os.environ.insert(0, os.environ["BZR_HOME"])
144
145setup(
146 distclass=DocbookDistribution,
147 name='pqm',
148 version='0',
149 maintainer="Robert Collins",
150 maintainer_email="robertc@robertcollins.net",
151 url='http://launchpad.net/pqm',
152 description='Patch Queue Manager.',
153 packages=[
154 'pqm',
155 'pqm.tests',
156 'pqm.ui',
157 'pqm.ui.tests',
158 ],
159 scripts=[
160 'bin/pqm',
161 ],
162 cmdclass={
163 'build': Build,
164 'install': Install,
165 'build_html': BuildDocbookHTML,
166 'install_html': InstallDocbookHTML,
167 'test': Trial
168 },
169 docbooks=[
170 'manual.xml'
171 ],
172 data_files=[
173 ('bin', ['bin/pqm-submit-merge']),
174 ('share/doc/pqm', ['sample-pqm.conf'])
175 ]
176)

Subscribers

People subscribed via source and target branches

to status/vote changes: