Merge lp:~ericsnowcurrently/fake-juju/python-lib-init into lp:~landscape/fake-juju/trunk-old
- python-lib-init
- Merge into trunk-old
Status: | Merged |
---|---|
Approved by: | Eric Snow |
Approved revision: | 38 |
Merged at revision: | 37 |
Proposed branch: | lp:~ericsnowcurrently/fake-juju/python-lib-init |
Merge into: | lp:~landscape/fake-juju/trunk-old |
Diff against target: |
344 lines (+318/-0) 5 files modified
python/LICENSE (+191/-0) python/Makefile (+9/-0) python/README.md (+1/-0) python/fakejuju/__init__.py (+48/-0) python/setup.py (+69/-0) |
To merge this branch: | bzr merge lp:~ericsnowcurrently/fake-juju/python-lib-init |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chad Smith | Approve | ||
Free Ekanayaka (community) | Approve | ||
🤖 Landscape Builder | test results | Approve | |
Review via email: mp+307889@code.launchpad.net |
Commit message
Init the Python project for a fake-juju library.
Description of the change
Init the Python project for a fake-juju library.
🤖 Landscape Builder (landscape-builder) : | # |
🤖 Landscape Builder (landscape-builder) wrote : | # |
Free Ekanayaka (free.ekanayaka) wrote : | # |
Nice job, thanks for the diligence. +1
Chad Smith (chad.smith) wrote : | # |
I'll probably need a bit of guidance on intent here.
# seems to pull in fakejuju/
cd python; python setup.py build
although python setup.py test chokes trying to find a distribution of txjuju, how will we be pulling txjuju dependencies?
Chad Smith (chad.smith) : | # |
Eric Snow (ericsnowcurrently) wrote : | # |
> I'll probably need a bit of guidance on intent here.
The intent is to pull the fake-juju bits out of txjuju.testing and into a more useful fakejuju library here.
> # seems to pull in fakejuju/
> cd python; python setup.py build
>
>
> although python setup.py test chokes trying to find a distribution of txjuju,
> how will we be pulling txjuju dependencies?
"python setup.py test"? Does that come for free? There aren't any tests in this patch. You are correct that setup.py won't work as-is. I'm okay with that. :) As long as the deb package works we're fine. The setup.py is mostly informational and useful for building the initial deb packaging code.
Eric Snow (ericsnowcurrently) : | # |
Chad Smith (chad.smith) wrote : | # |
Thanks for the IRC discussion on this. I wrapped myself around the axle actually trying to build a deb package from this new setup.py as I thought it implied you wanted to use this in the future to generate deb packages.
Preview Diff
1 | === added directory 'python' | |||
2 | === added file 'python/LICENSE' | |||
3 | --- python/LICENSE 1970-01-01 00:00:00 +0000 | |||
4 | +++ python/LICENSE 2016-10-06 21:47:41 +0000 | |||
5 | @@ -0,0 +1,191 @@ | |||
6 | 1 | All files in this repository are licensed as follows. If you contribute | ||
7 | 2 | to this repository, it is assumed that you license your contribution | ||
8 | 3 | under the same license unless you state otherwise. | ||
9 | 4 | |||
10 | 5 | All files Copyright (C) 2012-2016 Canonical Ltd. unless otherwise specified in the file. | ||
11 | 6 | |||
12 | 7 | This software is licensed under the LGPLv3, included below. | ||
13 | 8 | |||
14 | 9 | As a special exception to the GNU Lesser General Public License version 3 | ||
15 | 10 | ("LGPL3"), the copyright holders of this Library give you permission to | ||
16 | 11 | convey to a third party a Combined Work that links statically or dynamically | ||
17 | 12 | to this Library without providing any Minimal Corresponding Source or | ||
18 | 13 | Minimal Application Code as set out in 4d or providing the installation | ||
19 | 14 | information set out in section 4e, provided that you comply with the other | ||
20 | 15 | provisions of LGPL3 and provided that you meet, for the Application the | ||
21 | 16 | terms and conditions of the license(s) which apply to the Application. | ||
22 | 17 | |||
23 | 18 | Except as stated in this special exception, the provisions of LGPL3 will | ||
24 | 19 | continue to comply in full to this Library. If you modify this Library, you | ||
25 | 20 | may apply this exception to your version of this Library, but you are not | ||
26 | 21 | obliged to do so. If you do not wish to do so, delete this exception | ||
27 | 22 | statement from your version. This exception does not (and cannot) modify any | ||
28 | 23 | license terms which apply to the Application, with which you must still | ||
29 | 24 | comply. | ||
30 | 25 | |||
31 | 26 | |||
32 | 27 | GNU LESSER GENERAL PUBLIC LICENSE | ||
33 | 28 | Version 3, 29 June 2007 | ||
34 | 29 | |||
35 | 30 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | ||
36 | 31 | Everyone is permitted to copy and distribute verbatim copies | ||
37 | 32 | of this license document, but changing it is not allowed. | ||
38 | 33 | |||
39 | 34 | |||
40 | 35 | This version of the GNU Lesser General Public License incorporates | ||
41 | 36 | the terms and conditions of version 3 of the GNU General Public | ||
42 | 37 | License, supplemented by the additional permissions listed below. | ||
43 | 38 | |||
44 | 39 | 0. Additional Definitions. | ||
45 | 40 | |||
46 | 41 | As used herein, "this License" refers to version 3 of the GNU Lesser | ||
47 | 42 | General Public License, and the "GNU GPL" refers to version 3 of the GNU | ||
48 | 43 | General Public License. | ||
49 | 44 | |||
50 | 45 | "The Library" refers to a covered work governed by this License, | ||
51 | 46 | other than an Application or a Combined Work as defined below. | ||
52 | 47 | |||
53 | 48 | An "Application" is any work that makes use of an interface provided | ||
54 | 49 | by the Library, but which is not otherwise based on the Library. | ||
55 | 50 | Defining a subclass of a class defined by the Library is deemed a mode | ||
56 | 51 | of using an interface provided by the Library. | ||
57 | 52 | |||
58 | 53 | A "Combined Work" is a work produced by combining or linking an | ||
59 | 54 | Application with the Library. The particular version of the Library | ||
60 | 55 | with which the Combined Work was made is also called the "Linked | ||
61 | 56 | Version". | ||
62 | 57 | |||
63 | 58 | The "Minimal Corresponding Source" for a Combined Work means the | ||
64 | 59 | Corresponding Source for the Combined Work, excluding any source code | ||
65 | 60 | for portions of the Combined Work that, considered in isolation, are | ||
66 | 61 | based on the Application, and not on the Linked Version. | ||
67 | 62 | |||
68 | 63 | The "Corresponding Application Code" for a Combined Work means the | ||
69 | 64 | object code and/or source code for the Application, including any data | ||
70 | 65 | and utility programs needed for reproducing the Combined Work from the | ||
71 | 66 | Application, but excluding the System Libraries of the Combined Work. | ||
72 | 67 | |||
73 | 68 | 1. Exception to Section 3 of the GNU GPL. | ||
74 | 69 | |||
75 | 70 | You may convey a covered work under sections 3 and 4 of this License | ||
76 | 71 | without being bound by section 3 of the GNU GPL. | ||
77 | 72 | |||
78 | 73 | 2. Conveying Modified Versions. | ||
79 | 74 | |||
80 | 75 | If you modify a copy of the Library, and, in your modifications, a | ||
81 | 76 | facility refers to a function or data to be supplied by an Application | ||
82 | 77 | that uses the facility (other than as an argument passed when the | ||
83 | 78 | facility is invoked), then you may convey a copy of the modified | ||
84 | 79 | version: | ||
85 | 80 | |||
86 | 81 | a) under this License, provided that you make a good faith effort to | ||
87 | 82 | ensure that, in the event an Application does not supply the | ||
88 | 83 | function or data, the facility still operates, and performs | ||
89 | 84 | whatever part of its purpose remains meaningful, or | ||
90 | 85 | |||
91 | 86 | b) under the GNU GPL, with none of the additional permissions of | ||
92 | 87 | this License applicable to that copy. | ||
93 | 88 | |||
94 | 89 | 3. Object Code Incorporating Material from Library Header Files. | ||
95 | 90 | |||
96 | 91 | The object code form of an Application may incorporate material from | ||
97 | 92 | a header file that is part of the Library. You may convey such object | ||
98 | 93 | code under terms of your choice, provided that, if the incorporated | ||
99 | 94 | material is not limited to numerical parameters, data structure | ||
100 | 95 | layouts and accessors, or small macros, inline functions and templates | ||
101 | 96 | (ten or fewer lines in length), you do both of the following: | ||
102 | 97 | |||
103 | 98 | a) Give prominent notice with each copy of the object code that the | ||
104 | 99 | Library is used in it and that the Library and its use are | ||
105 | 100 | covered by this License. | ||
106 | 101 | |||
107 | 102 | b) Accompany the object code with a copy of the GNU GPL and this license | ||
108 | 103 | document. | ||
109 | 104 | |||
110 | 105 | 4. Combined Works. | ||
111 | 106 | |||
112 | 107 | You may convey a Combined Work under terms of your choice that, | ||
113 | 108 | taken together, effectively do not restrict modification of the | ||
114 | 109 | portions of the Library contained in the Combined Work and reverse | ||
115 | 110 | engineering for debugging such modifications, if you also do each of | ||
116 | 111 | the following: | ||
117 | 112 | |||
118 | 113 | a) Give prominent notice with each copy of the Combined Work that | ||
119 | 114 | the Library is used in it and that the Library and its use are | ||
120 | 115 | covered by this License. | ||
121 | 116 | |||
122 | 117 | b) Accompany the Combined Work with a copy of the GNU GPL and this license | ||
123 | 118 | document. | ||
124 | 119 | |||
125 | 120 | c) For a Combined Work that displays copyright notices during | ||
126 | 121 | execution, include the copyright notice for the Library among | ||
127 | 122 | these notices, as well as a reference directing the user to the | ||
128 | 123 | copies of the GNU GPL and this license document. | ||
129 | 124 | |||
130 | 125 | d) Do one of the following: | ||
131 | 126 | |||
132 | 127 | 0) Convey the Minimal Corresponding Source under the terms of this | ||
133 | 128 | License, and the Corresponding Application Code in a form | ||
134 | 129 | suitable for, and under terms that permit, the user to | ||
135 | 130 | recombine or relink the Application with a modified version of | ||
136 | 131 | the Linked Version to produce a modified Combined Work, in the | ||
137 | 132 | manner specified by section 6 of the GNU GPL for conveying | ||
138 | 133 | Corresponding Source. | ||
139 | 134 | |||
140 | 135 | 1) Use a suitable shared library mechanism for linking with the | ||
141 | 136 | Library. A suitable mechanism is one that (a) uses at run time | ||
142 | 137 | a copy of the Library already present on the user's computer | ||
143 | 138 | system, and (b) will operate properly with a modified version | ||
144 | 139 | of the Library that is interface-compatible with the Linked | ||
145 | 140 | Version. | ||
146 | 141 | |||
147 | 142 | e) Provide Installation Information, but only if you would otherwise | ||
148 | 143 | be required to provide such information under section 6 of the | ||
149 | 144 | GNU GPL, and only to the extent that such information is | ||
150 | 145 | necessary to install and execute a modified version of the | ||
151 | 146 | Combined Work produced by recombining or relinking the | ||
152 | 147 | Application with a modified version of the Linked Version. (If | ||
153 | 148 | you use option 4d0, the Installation Information must accompany | ||
154 | 149 | the Minimal Corresponding Source and Corresponding Application | ||
155 | 150 | Code. If you use option 4d1, you must provide the Installation | ||
156 | 151 | Information in the manner specified by section 6 of the GNU GPL | ||
157 | 152 | for conveying Corresponding Source.) | ||
158 | 153 | |||
159 | 154 | 5. Combined Libraries. | ||
160 | 155 | |||
161 | 156 | You may place library facilities that are a work based on the | ||
162 | 157 | Library side by side in a single library together with other library | ||
163 | 158 | facilities that are not Applications and are not covered by this | ||
164 | 159 | License, and convey such a combined library under terms of your | ||
165 | 160 | choice, if you do both of the following: | ||
166 | 161 | |||
167 | 162 | a) Accompany the combined library with a copy of the same work based | ||
168 | 163 | on the Library, uncombined with any other library facilities, | ||
169 | 164 | conveyed under the terms of this License. | ||
170 | 165 | |||
171 | 166 | b) Give prominent notice with the combined library that part of it | ||
172 | 167 | is a work based on the Library, and explaining where to find the | ||
173 | 168 | accompanying uncombined form of the same work. | ||
174 | 169 | |||
175 | 170 | 6. Revised Versions of the GNU Lesser General Public License. | ||
176 | 171 | |||
177 | 172 | The Free Software Foundation may publish revised and/or new versions | ||
178 | 173 | of the GNU Lesser General Public License from time to time. Such new | ||
179 | 174 | versions will be similar in spirit to the present version, but may | ||
180 | 175 | differ in detail to address new problems or concerns. | ||
181 | 176 | |||
182 | 177 | Each version is given a distinguishing version number. If the | ||
183 | 178 | Library as you received it specifies that a certain numbered version | ||
184 | 179 | of the GNU Lesser General Public License "or any later version" | ||
185 | 180 | applies to it, you have the option of following the terms and | ||
186 | 181 | conditions either of that published version or of any later version | ||
187 | 182 | published by the Free Software Foundation. If the Library as you | ||
188 | 183 | received it does not specify a version number of the GNU Lesser | ||
189 | 184 | General Public License, you may choose any version of the GNU Lesser | ||
190 | 185 | General Public License ever published by the Free Software Foundation. | ||
191 | 186 | |||
192 | 187 | If the Library as you received it specifies that a proxy can decide | ||
193 | 188 | whether future versions of the GNU Lesser General Public License shall | ||
194 | 189 | apply, that proxy's public statement of acceptance of any version is | ||
195 | 190 | permanent authorization for you to choose that version for the | ||
196 | 191 | Library. | ||
197 | 0 | 192 | ||
198 | === added file 'python/Makefile' | |||
199 | --- python/Makefile 1970-01-01 00:00:00 +0000 | |||
200 | +++ python/Makefile 2016-10-06 21:47:41 +0000 | |||
201 | @@ -0,0 +1,9 @@ | |||
202 | 1 | PYTHON = python | ||
203 | 2 | |||
204 | 3 | .PHONY: test | ||
205 | 4 | test: | ||
206 | 5 | $(PYTHON) -m unittest discover -t $(shell pwd) -s $(shell pwd)/fakejuju | ||
207 | 6 | |||
208 | 7 | .PHONY: install-dev | ||
209 | 8 | install-dev: | ||
210 | 9 | ln -s $(shell pwd)/fakejuju /usr/local/lib/python2.7/dist-packages/fakejuju | ||
211 | 0 | 10 | ||
212 | === added file 'python/README.md' | |||
213 | --- python/README.md 1970-01-01 00:00:00 +0000 | |||
214 | +++ python/README.md 2016-10-06 21:47:41 +0000 | |||
215 | @@ -0,0 +1,1 @@ | |||
216 | 1 | # fakejuju | ||
217 | 0 | 2 | ||
218 | === added directory 'python/fakejuju' | |||
219 | === added file 'python/fakejuju/__init__.py' | |||
220 | --- python/fakejuju/__init__.py 1970-01-01 00:00:00 +0000 | |||
221 | +++ python/fakejuju/__init__.py 2016-10-06 21:47:41 +0000 | |||
222 | @@ -0,0 +1,48 @@ | |||
223 | 1 | # Copyright 2016 Canonical Limited. All rights reserved. | ||
224 | 2 | |||
225 | 3 | """Support for interaction with fake-juju. | ||
226 | 4 | |||
227 | 5 | "fake-juju" is a combination of the juju and jujud commands that is | ||
228 | 6 | suitable for use in integration tests. It exposes a limited subset | ||
229 | 7 | of the standard juju subcommands (see FakeJuju in this module for | ||
230 | 8 | specifics). When called without any arguments it runs jujud (using | ||
231 | 9 | the dummy provider) with extra logging and testing hooks available to | ||
232 | 10 | control failures. See https://launchpad.net/fake-juju for the project. | ||
233 | 11 | |||
234 | 12 | The binary is named with the Juju version for which it was built. | ||
235 | 13 | For example, for version 1.25.6 the file is named "fake-juju-1.25.6". | ||
236 | 14 | |||
237 | 15 | fake-juju uses the normal Juju local config directory. This defaults | ||
238 | 16 | to ~/.local/shared/juju and may be set using the JUJU_DATA environment | ||
239 | 17 | variable (in 2.x, for 1.x it is JUJU_HOME). | ||
240 | 18 | |||
241 | 19 | In addition to all the normal Juju environment variables (e.g. | ||
242 | 20 | JUJU_DATA), fake-juju uses the following: | ||
243 | 21 | |||
244 | 22 | FAKE_JUJU_FAILURES - the path to the failures file | ||
245 | 23 | The Failures class below sets this to $JUJU_DATA/juju-failures. | ||
246 | 24 | FAKE_JUJU_LOGS_DIR - the path to the logs directory | ||
247 | 25 | This defaults to $JUJU_DATA. | ||
248 | 26 | |||
249 | 27 | fake-juju also creates several extra files: | ||
250 | 28 | |||
251 | 29 | $FAKE_JUJU_LOGS_DIR/fake-juju.log - where fake-juju logs are written | ||
252 | 30 | $JUJU_DATA/fakejuju - fake-juju's data cache | ||
253 | 31 | $JUJU_DATA/fifo - a FIFO file that triggers jujud shutdown | ||
254 | 32 | $JUJU_DATA/cert.ca - the API's CA certificate | ||
255 | 33 | |||
256 | 34 | Normal Juju logging for is written to $JUJU_DATA/fake-juju.log. | ||
257 | 35 | |||
258 | 36 | Failures may be injected into a running fake-juju (or set before | ||
259 | 37 | running). They may be injected by adding them to the file identified | ||
260 | 38 | by $FAKE_JUJU_FAILURES. The format is a single failure definition per | ||
261 | 39 | line. The syntax of the failure definition depends on the failure. | ||
262 | 40 | The currently supported failures (with their definition syntax) are | ||
263 | 41 | listed here: | ||
264 | 42 | |||
265 | 43 | * when adding a unit with a specific ID | ||
266 | 44 | format: "unit-<ID>" (e.g. unit-mysql/0) | ||
267 | 45 | |||
268 | 46 | """ | ||
269 | 47 | |||
270 | 48 | __version__ = "0.9.0b1" | ||
271 | 0 | 49 | ||
272 | === added file 'python/setup.py' | |||
273 | --- python/setup.py 1970-01-01 00:00:00 +0000 | |||
274 | +++ python/setup.py 2016-10-06 21:47:41 +0000 | |||
275 | @@ -0,0 +1,69 @@ | |||
276 | 1 | import os | ||
277 | 2 | from importlib import import_module | ||
278 | 3 | try: | ||
279 | 4 | from setuptools import setup | ||
280 | 5 | except ImportError: | ||
281 | 6 | from distutils.core import setup | ||
282 | 7 | |||
283 | 8 | |||
284 | 9 | basedir = os.path.abspath(os.path.dirname(__file__) or '.') | ||
285 | 10 | |||
286 | 11 | # required data | ||
287 | 12 | |||
288 | 13 | package_name = 'fakejuju' | ||
289 | 14 | NAME = package_name | ||
290 | 15 | SUMMARY = 'A limited adaptation of Juju\'s client, with testing hooks.' | ||
291 | 16 | AUTHOR = 'Canonical Landscape team' | ||
292 | 17 | EMAIL = 'juju@lists.ubuntu.com' | ||
293 | 18 | PROJECT_URL = 'https://launchpad.net/fake-juju' | ||
294 | 19 | LICENSE = 'LGPLv3' | ||
295 | 20 | |||
296 | 21 | with open(os.path.join(basedir, 'README.md')) as readme_file: | ||
297 | 22 | DESCRIPTION = readme_file.read() | ||
298 | 23 | |||
299 | 24 | # dymanically generated data | ||
300 | 25 | |||
301 | 26 | VERSION = import_module(package_name).__version__ | ||
302 | 27 | |||
303 | 28 | # set up packages | ||
304 | 29 | |||
305 | 30 | exclude_dirs = [ | ||
306 | 31 | 'tests', | ||
307 | 32 | ] | ||
308 | 33 | |||
309 | 34 | PACKAGES = [] | ||
310 | 35 | for path, dirs, files in os.walk(package_name): | ||
311 | 36 | if "__init__.py" not in files: | ||
312 | 37 | continue | ||
313 | 38 | path = path.split(os.sep) | ||
314 | 39 | if path[-1] in exclude_dirs: | ||
315 | 40 | continue | ||
316 | 41 | PACKAGES.append(".".join(path)) | ||
317 | 42 | |||
318 | 43 | # dependencies | ||
319 | 44 | |||
320 | 45 | DEPS = ['yaml', | ||
321 | 46 | # for testing | ||
322 | 47 | 'txjuju', | ||
323 | 48 | 'fixtures', | ||
324 | 49 | 'testtools', | ||
325 | 50 | ] | ||
326 | 51 | |||
327 | 52 | |||
328 | 53 | if __name__ == "__main__": | ||
329 | 54 | setup(name=NAME, | ||
330 | 55 | version=VERSION, | ||
331 | 56 | author=AUTHOR, | ||
332 | 57 | author_email=EMAIL, | ||
333 | 58 | url=PROJECT_URL, | ||
334 | 59 | license=LICENSE, | ||
335 | 60 | description=SUMMARY, | ||
336 | 61 | long_description=DESCRIPTION, | ||
337 | 62 | packages=PACKAGES, | ||
338 | 63 | |||
339 | 64 | # for distutils | ||
340 | 65 | requires=DEPS, | ||
341 | 66 | |||
342 | 67 | # for setuptools | ||
343 | 68 | install_requires=DEPS, | ||
344 | 69 | ) |
Command: make ci-test /ci.lscape. net/job/ latch-test- xenial/ 14/
Result: Success
Revno: 38
Branch: lp:~ericsnowcurrently/fake-juju/python-lib-init
Jenkins: https:/