Merge lp:~ericsnowcurrently/fake-juju/python-lib-init into lp:~landscape/fake-juju/trunk-old

Proposed by Eric Snow
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
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.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 38
Branch: lp:~ericsnowcurrently/fake-juju/python-lib-init
Jenkins: https://ci.lscape.net/job/latch-test-xenial/14/

review: Approve (test results)
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Nice job, thanks for the diligence. +1

review: Approve
Revision history for this message
Chad Smith (chad.smith) wrote :

I'll probably need a bit of guidance on intent here.

# seems to pull in fakejuju/__init__.py fine into the build directory.
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?

Revision history for this message
Chad Smith (chad.smith) :
review: Needs Information
Revision history for this message
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/__init__.py fine into the build directory.
> 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.

Revision history for this message
Eric Snow (ericsnowcurrently) :
Revision history for this message
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.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'python'
=== added file 'python/LICENSE'
--- python/LICENSE 1970-01-01 00:00:00 +0000
+++ python/LICENSE 2016-10-06 21:47:41 +0000
@@ -0,0 +1,191 @@
1All files in this repository are licensed as follows. If you contribute
2to this repository, it is assumed that you license your contribution
3under the same license unless you state otherwise.
4
5All files Copyright (C) 2012-2016 Canonical Ltd. unless otherwise specified in the file.
6
7This software is licensed under the LGPLv3, included below.
8
9As a special exception to the GNU Lesser General Public License version 3
10("LGPL3"), the copyright holders of this Library give you permission to
11convey to a third party a Combined Work that links statically or dynamically
12to this Library without providing any Minimal Corresponding Source or
13Minimal Application Code as set out in 4d or providing the installation
14information set out in section 4e, provided that you comply with the other
15provisions of LGPL3 and provided that you meet, for the Application the
16terms and conditions of the license(s) which apply to the Application.
17
18Except as stated in this special exception, the provisions of LGPL3 will
19continue to comply in full to this Library. If you modify this Library, you
20may apply this exception to your version of this Library, but you are not
21obliged to do so. If you do not wish to do so, delete this exception
22statement from your version. This exception does not (and cannot) modify any
23license terms which apply to the Application, with which you must still
24comply.
25
26
27 GNU LESSER GENERAL PUBLIC LICENSE
28 Version 3, 29 June 2007
29
30 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
31 Everyone is permitted to copy and distribute verbatim copies
32 of this license document, but changing it is not allowed.
33
34
35 This version of the GNU Lesser General Public License incorporates
36the terms and conditions of version 3 of the GNU General Public
37License, supplemented by the additional permissions listed below.
38
39 0. Additional Definitions.
40
41 As used herein, "this License" refers to version 3 of the GNU Lesser
42General Public License, and the "GNU GPL" refers to version 3 of the GNU
43General Public License.
44
45 "The Library" refers to a covered work governed by this License,
46other than an Application or a Combined Work as defined below.
47
48 An "Application" is any work that makes use of an interface provided
49by the Library, but which is not otherwise based on the Library.
50Defining a subclass of a class defined by the Library is deemed a mode
51of using an interface provided by the Library.
52
53 A "Combined Work" is a work produced by combining or linking an
54Application with the Library. The particular version of the Library
55with which the Combined Work was made is also called the "Linked
56Version".
57
58 The "Minimal Corresponding Source" for a Combined Work means the
59Corresponding Source for the Combined Work, excluding any source code
60for portions of the Combined Work that, considered in isolation, are
61based on the Application, and not on the Linked Version.
62
63 The "Corresponding Application Code" for a Combined Work means the
64object code and/or source code for the Application, including any data
65and utility programs needed for reproducing the Combined Work from the
66Application, but excluding the System Libraries of the Combined Work.
67
68 1. Exception to Section 3 of the GNU GPL.
69
70 You may convey a covered work under sections 3 and 4 of this License
71without being bound by section 3 of the GNU GPL.
72
73 2. Conveying Modified Versions.
74
75 If you modify a copy of the Library, and, in your modifications, a
76facility refers to a function or data to be supplied by an Application
77that uses the facility (other than as an argument passed when the
78facility is invoked), then you may convey a copy of the modified
79version:
80
81 a) under this License, provided that you make a good faith effort to
82 ensure that, in the event an Application does not supply the
83 function or data, the facility still operates, and performs
84 whatever part of its purpose remains meaningful, or
85
86 b) under the GNU GPL, with none of the additional permissions of
87 this License applicable to that copy.
88
89 3. Object Code Incorporating Material from Library Header Files.
90
91 The object code form of an Application may incorporate material from
92a header file that is part of the Library. You may convey such object
93code under terms of your choice, provided that, if the incorporated
94material is not limited to numerical parameters, data structure
95layouts and accessors, or small macros, inline functions and templates
96(ten or fewer lines in length), you do both of the following:
97
98 a) Give prominent notice with each copy of the object code that the
99 Library is used in it and that the Library and its use are
100 covered by this License.
101
102 b) Accompany the object code with a copy of the GNU GPL and this license
103 document.
104
105 4. Combined Works.
106
107 You may convey a Combined Work under terms of your choice that,
108taken together, effectively do not restrict modification of the
109portions of the Library contained in the Combined Work and reverse
110engineering for debugging such modifications, if you also do each of
111the following:
112
113 a) Give prominent notice with each copy of the Combined Work that
114 the Library is used in it and that the Library and its use are
115 covered by this License.
116
117 b) Accompany the Combined Work with a copy of the GNU GPL and this license
118 document.
119
120 c) For a Combined Work that displays copyright notices during
121 execution, include the copyright notice for the Library among
122 these notices, as well as a reference directing the user to the
123 copies of the GNU GPL and this license document.
124
125 d) Do one of the following:
126
127 0) Convey the Minimal Corresponding Source under the terms of this
128 License, and the Corresponding Application Code in a form
129 suitable for, and under terms that permit, the user to
130 recombine or relink the Application with a modified version of
131 the Linked Version to produce a modified Combined Work, in the
132 manner specified by section 6 of the GNU GPL for conveying
133 Corresponding Source.
134
135 1) Use a suitable shared library mechanism for linking with the
136 Library. A suitable mechanism is one that (a) uses at run time
137 a copy of the Library already present on the user's computer
138 system, and (b) will operate properly with a modified version
139 of the Library that is interface-compatible with the Linked
140 Version.
141
142 e) Provide Installation Information, but only if you would otherwise
143 be required to provide such information under section 6 of the
144 GNU GPL, and only to the extent that such information is
145 necessary to install and execute a modified version of the
146 Combined Work produced by recombining or relinking the
147 Application with a modified version of the Linked Version. (If
148 you use option 4d0, the Installation Information must accompany
149 the Minimal Corresponding Source and Corresponding Application
150 Code. If you use option 4d1, you must provide the Installation
151 Information in the manner specified by section 6 of the GNU GPL
152 for conveying Corresponding Source.)
153
154 5. Combined Libraries.
155
156 You may place library facilities that are a work based on the
157Library side by side in a single library together with other library
158facilities that are not Applications and are not covered by this
159License, and convey such a combined library under terms of your
160choice, if you do both of the following:
161
162 a) Accompany the combined library with a copy of the same work based
163 on the Library, uncombined with any other library facilities,
164 conveyed under the terms of this License.
165
166 b) Give prominent notice with the combined library that part of it
167 is a work based on the Library, and explaining where to find the
168 accompanying uncombined form of the same work.
169
170 6. Revised Versions of the GNU Lesser General Public License.
171
172 The Free Software Foundation may publish revised and/or new versions
173of the GNU Lesser General Public License from time to time. Such new
174versions will be similar in spirit to the present version, but may
175differ in detail to address new problems or concerns.
176
177 Each version is given a distinguishing version number. If the
178Library as you received it specifies that a certain numbered version
179of the GNU Lesser General Public License "or any later version"
180applies to it, you have the option of following the terms and
181conditions either of that published version or of any later version
182published by the Free Software Foundation. If the Library as you
183received it does not specify a version number of the GNU Lesser
184General Public License, you may choose any version of the GNU Lesser
185General Public License ever published by the Free Software Foundation.
186
187 If the Library as you received it specifies that a proxy can decide
188whether future versions of the GNU Lesser General Public License shall
189apply, that proxy's public statement of acceptance of any version is
190permanent authorization for you to choose that version for the
191Library.
0192
=== added file 'python/Makefile'
--- python/Makefile 1970-01-01 00:00:00 +0000
+++ python/Makefile 2016-10-06 21:47:41 +0000
@@ -0,0 +1,9 @@
1PYTHON = python
2
3.PHONY: test
4test:
5 $(PYTHON) -m unittest discover -t $(shell pwd) -s $(shell pwd)/fakejuju
6
7.PHONY: install-dev
8install-dev:
9 ln -s $(shell pwd)/fakejuju /usr/local/lib/python2.7/dist-packages/fakejuju
010
=== added file 'python/README.md'
--- python/README.md 1970-01-01 00:00:00 +0000
+++ python/README.md 2016-10-06 21:47:41 +0000
@@ -0,0 +1,1 @@
1# fakejuju
02
=== added directory 'python/fakejuju'
=== added file 'python/fakejuju/__init__.py'
--- python/fakejuju/__init__.py 1970-01-01 00:00:00 +0000
+++ python/fakejuju/__init__.py 2016-10-06 21:47:41 +0000
@@ -0,0 +1,48 @@
1# Copyright 2016 Canonical Limited. All rights reserved.
2
3"""Support for interaction with fake-juju.
4
5"fake-juju" is a combination of the juju and jujud commands that is
6suitable for use in integration tests. It exposes a limited subset
7of the standard juju subcommands (see FakeJuju in this module for
8specifics). When called without any arguments it runs jujud (using
9the dummy provider) with extra logging and testing hooks available to
10control failures. See https://launchpad.net/fake-juju for the project.
11
12The binary is named with the Juju version for which it was built.
13For example, for version 1.25.6 the file is named "fake-juju-1.25.6".
14
15fake-juju uses the normal Juju local config directory. This defaults
16to ~/.local/shared/juju and may be set using the JUJU_DATA environment
17variable (in 2.x, for 1.x it is JUJU_HOME).
18
19In addition to all the normal Juju environment variables (e.g.
20JUJU_DATA), fake-juju uses the following:
21
22 FAKE_JUJU_FAILURES - the path to the failures file
23 The Failures class below sets this to $JUJU_DATA/juju-failures.
24 FAKE_JUJU_LOGS_DIR - the path to the logs directory
25 This defaults to $JUJU_DATA.
26
27fake-juju also creates several extra files:
28
29 $FAKE_JUJU_LOGS_DIR/fake-juju.log - where fake-juju logs are written
30 $JUJU_DATA/fakejuju - fake-juju's data cache
31 $JUJU_DATA/fifo - a FIFO file that triggers jujud shutdown
32 $JUJU_DATA/cert.ca - the API's CA certificate
33
34Normal Juju logging for is written to $JUJU_DATA/fake-juju.log.
35
36Failures may be injected into a running fake-juju (or set before
37running). They may be injected by adding them to the file identified
38by $FAKE_JUJU_FAILURES. The format is a single failure definition per
39line. The syntax of the failure definition depends on the failure.
40The currently supported failures (with their definition syntax) are
41listed here:
42
43 * when adding a unit with a specific ID
44 format: "unit-<ID>" (e.g. unit-mysql/0)
45
46"""
47
48__version__ = "0.9.0b1"
049
=== added file 'python/setup.py'
--- python/setup.py 1970-01-01 00:00:00 +0000
+++ python/setup.py 2016-10-06 21:47:41 +0000
@@ -0,0 +1,69 @@
1import os
2from importlib import import_module
3try:
4 from setuptools import setup
5except ImportError:
6 from distutils.core import setup
7
8
9basedir = os.path.abspath(os.path.dirname(__file__) or '.')
10
11# required data
12
13package_name = 'fakejuju'
14NAME = package_name
15SUMMARY = 'A limited adaptation of Juju\'s client, with testing hooks.'
16AUTHOR = 'Canonical Landscape team'
17EMAIL = 'juju@lists.ubuntu.com'
18PROJECT_URL = 'https://launchpad.net/fake-juju'
19LICENSE = 'LGPLv3'
20
21with open(os.path.join(basedir, 'README.md')) as readme_file:
22 DESCRIPTION = readme_file.read()
23
24# dymanically generated data
25
26VERSION = import_module(package_name).__version__
27
28# set up packages
29
30exclude_dirs = [
31 'tests',
32 ]
33
34PACKAGES = []
35for path, dirs, files in os.walk(package_name):
36 if "__init__.py" not in files:
37 continue
38 path = path.split(os.sep)
39 if path[-1] in exclude_dirs:
40 continue
41 PACKAGES.append(".".join(path))
42
43# dependencies
44
45DEPS = ['yaml',
46 # for testing
47 'txjuju',
48 'fixtures',
49 'testtools',
50 ]
51
52
53if __name__ == "__main__":
54 setup(name=NAME,
55 version=VERSION,
56 author=AUTHOR,
57 author_email=EMAIL,
58 url=PROJECT_URL,
59 license=LICENSE,
60 description=SUMMARY,
61 long_description=DESCRIPTION,
62 packages=PACKAGES,
63
64 # for distutils
65 requires=DEPS,
66
67 # for setuptools
68 install_requires=DEPS,
69 )

Subscribers

People subscribed via source and target branches

to all changes: