Merge lp:~rockstar/tarmac/die-makefile-die into lp:tarmac

Proposed by Paul Hummer
Status: Merged
Approved by: Paul Hummer
Approved revision: 393
Merged at revision: 388
Proposed branch: lp:~rockstar/tarmac/die-makefile-die
Merge into: lp:tarmac
Diff against target: 117 lines (+67/-29)
2 files modified
Makefile (+0/-28)
setup.py (+67/-1)
To merge this branch: bzr merge lp:~rockstar/tarmac/die-makefile-die
Reviewer Review Type Date Requested Status
dobey Approve
Paul Hummer Pending
Review via email: mp+49671@code.launchpad.net

Commit message

Kill the Makefile

Description of the change

I killed the Makefile. Rodney and I had already talked about it, and it didn't take too much effort for Rodney to convince me that we don't need it.

All the functionality has been ported over to distutils stuff, except for test-fail, which I couldn't find a use for anywhere.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

The clean command needs to derive from the one provided by distutils and chain up to it. For a simple example, the ubuntuone-storage-protocol clean command does this:

http://bazaar.launchpad.net/~ubuntuone-control-tower/ubuntuone-storage-protocol/trunk/view/head:/setup.py#L57

review: Needs Fixing
lp:~rockstar/tarmac/die-makefile-die updated
393. By Paul Hummer

CleanCommand now DTRT

Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'Makefile'
2--- Makefile 2010-07-20 06:46:47 +0000
3+++ Makefile 1970-01-01 00:00:00 +0000
4@@ -1,28 +0,0 @@
5-TESTFLAGS=
6-test:
7- trial $(TESTFLAGS) tarmac
8-
9-test-fail:
10- trial this-will-fail
11-
12-build:
13- mkdir build
14- mkdir build/docs
15-
16-build/docs/introduction.html: build docs/introduction.txt
17- rst2html docs/introduction.txt build/docs/introduction.html
18-
19-build/docs/writingplugins.html: build docs/writingplugins.txt
20- rst2html docs/writingplugins.txt build/docs/writingplugins.html
21-
22-doc: build/docs/introduction.html build/docs/writingplugins.html
23-
24-clean:
25- rm -rf build
26-
27-release:
28- python setup.py sdist
29- cd dist
30- gpg --armor --sign --detach-sig `find . -name "tarmac-*"`
31-
32-.PHONY: test test-fail
33
34=== modified file 'setup.py'
35--- setup.py 2010-08-17 17:08:07 +0000
36+++ setup.py 2011-02-14 17:46:28 +0000
37@@ -17,13 +17,79 @@
38 # along with Tarmac. If not, see <http://www.gnu.org/licenses/>.
39 '''Tarmac installation script.'''
40
41-from distutils.core import setup
42+from distutils.command import clean
43+from distutils.core import Command, setup
44+import os
45
46 from tarmac import __version__
47
48+
49+class BaseCommand(Command):
50+ '''A base command...'''
51+
52+ user_options = []
53+
54+ def initialize_options(self):
55+ self.cwd = None
56+
57+ def finalize_options(self):
58+ self.cwd = os.getcwd()
59+
60+
61+class CleanCommand(clean.clean):
62+ '''Customized command for clean.'''
63+
64+ description = 'Customized clean command'
65+
66+ def run(self):
67+ os.system('rm -rf build _trial_temp dist')
68+
69+ super(CleanCommand, self).run()
70+
71+
72+class DocCommand(BaseCommand):
73+ '''Command for building the docs.'''
74+
75+ description = 'Build the docs'
76+
77+ def run(self):
78+ if not os.path.exists('build/docs'):
79+ os.makedirs('build/docs')
80+ os.system(
81+ 'rst2html docs/introduction.txt build/docs/introduction.html')
82+ os.system(
83+ 'rst2html docs/writingplugins.txt build/docs/writingplugins.html')
84+
85+
86+class ReleaseCommand(BaseCommand):
87+ '''A command for cutting releases.'''
88+
89+ description = 'Cut a release'
90+
91+ def run(self):
92+ os.system('python setup.py sdist')
93+ os.system(
94+ 'gpg --armor --sign --detach-sig `find dist -name "tarmac-*"`')
95+
96+
97+class TestCommand(BaseCommand):
98+ '''A Command for running the tests.'''
99+
100+ description = 'Run the tests'
101+
102+ def run(self):
103+ os.system('trial tarmac')
104+
105+
106 setup(
107 author='Paul Hummer',
108 author_email='Paul Hummer <paul@eventuallyanyway.com',
109+ cmdclass={
110+ 'clean': CleanCommand,
111+ 'docs': DocCommand,
112+ 'release': ReleaseCommand,
113+ 'test': TestCommand
114+ },
115 name=u'tarmac',
116 version=__version__,
117 description=u'Tarmac - The Launchpad Lander',

Subscribers

People subscribed via source and target branches