Merge lp:~nataliabidart/magicicada-server/move-local-lib-src into lp:magicicada-server

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 15
Merged at revision: 14
Proposed branch: lp:~nataliabidart/magicicada-server/move-local-lib-src
Merge into: lp:magicicada-server
Diff against target: 350 lines (+89/-112)
8 files modified
Makefile (+1/-1)
lib/ubuntuone/storage/tests/__init__.py (+0/-18)
src/server/rzlib.py (+81/-80)
src/server/tests/test_rhashlib.py (+1/-1)
src/server/tests/test_rzlib.py (+3/-3)
src/server/tests/test_upload.py (+1/-2)
src/server/upload.py (+1/-2)
src/utilities/load_sample_data.py (+1/-5)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-server/move-local-lib-src
Reviewer Review Type Date Requested Status
Natalia Bidart Approve
Review via email: mp+270234@code.launchpad.net

Commit message

- Move owned source code from lib/ to src/. Ensure to replace old folders with links.
- Fixed lint issues from stuff coming from lib/.

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

Only code moved from lib/ to src/ as agreed with Facundo on IRC.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2015-09-04 19:32:02 +0000
3+++ Makefile 2015-09-05 01:20:53 +0000
4@@ -108,7 +108,7 @@
5 raw-test:
6 ./test $(TESTFLAGS)
7
8-test: sourcedeps clean lint version start-base start-dbus raw-test stop
9+test: lint sourcedeps clean version start-base start-dbus raw-test stop
10
11 ci-test:
12 $(MAKE) test TESTFLAGS="-1 $(TESTFLAGS)"
13
14=== added symlink 'lib/config.py'
15=== target is u'../src/config.py'
16=== added symlink 'lib/metrics'
17=== target is u'../src/metrics/'
18=== added symlink 'lib/ubuntuone/monitoring'
19=== target is u'../../src/monitoring/'
20=== removed directory 'lib/ubuntuone/storage/tests'
21=== removed file 'lib/ubuntuone/storage/tests/__init__.py'
22--- lib/ubuntuone/storage/tests/__init__.py 2015-08-05 13:10:02 +0000
23+++ lib/ubuntuone/storage/tests/__init__.py 1970-01-01 00:00:00 +0000
24@@ -1,18 +0,0 @@
25-# Copyright 2008-2015 Canonical
26-#
27-# This program is free software: you can redistribute it and/or modify
28-# it under the terms of the GNU Affero General Public License as
29-# published by the Free Software Foundation, either version 3 of the
30-# License, or (at your option) any later version.
31-#
32-# This program is distributed in the hope that it will be useful,
33-# but WITHOUT ANY WARRANTY; without even the implied warranty of
34-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35-# GNU Affero General Public License for more details.
36-#
37-# You should have received a copy of the GNU Affero General Public License
38-# along with this program. If not, see <http://www.gnu.org/licenses/>.
39-#
40-# For further info, check http://launchpad.net/filesync-server
41-
42-"""Loads and executes the tests in the module."""
43
44=== added symlink 'lib/ubuntuone/txutils'
45=== target is u'../../src/txutils/'
46=== added symlink 'lib/utilities'
47=== target is u'../src/utilities/'
48=== renamed file 'lib/config.py' => 'src/config.py'
49=== renamed directory 'lib/metrics' => 'src/metrics'
50=== renamed directory 'lib/ubuntuone/monitoring' => 'src/monitoring'
51=== renamed directory 'lib/ubuntuone/storage/tests/integration' => 'src/server/integration'
52=== renamed file 'lib/ubuntuone/storage/rhashlib.py' => 'src/server/rhashlib.py'
53=== renamed file 'lib/ubuntuone/storage/rzlib.py' => 'src/server/rzlib.py'
54--- lib/ubuntuone/storage/rzlib.py 2015-08-05 13:10:02 +0000
55+++ src/server/rzlib.py 2015-09-05 01:20:53 +0000
56@@ -40,26 +40,26 @@
57
58
59 # from inflate.h
60-#/*
61+# /*
62 # gzip header information passed to and from zlib routines. See RFC 1952
63-# for more details on the meanings of these fields.
64-#*/
65-#typedef struct gz_header_s {
66-# int text; /* true if compressed data believed to be text */
67-# uLong time; /* modification time */
68-# int xflags; /* extra flags (not used when writing a gzip file) */
69-# int os; /* operating system */
70-# Bytef *extra; /* pointer to extra field or Z_NULL if none */
71-# uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
72-# uInt extra_max; /* space at extra (only when reading header) */
73-# Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
74-# uInt name_max; /* space at name (only when reading header) */
75-# Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
76-# uInt comm_max; /* space at comment (only when reading header) */
77-# int hcrc; /* true if there was or will be a header crc */
78-# int done; /* true when done reading gzip header (not used
79-# when writing a gzip file) */
80-#} gz_header;
81+# for more details on the meanings of these fields.
82+# */
83+# typedef struct gz_header_s {
84+# int text; /* true if compressed data believed to be text */
85+# uLong time; /* modification time */
86+# int xflags; /* extra flags (not used when writing a gzip file) */
87+# int os; /* operating system */
88+# Bytef *extra; /* pointer to extra field or Z_NULL if none */
89+# uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
90+# uInt extra_max; /* space at extra (only when reading header) */
91+# Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
92+# uInt name_max; /* space at name (only when reading header) */
93+# Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
94+# uInt comm_max; /* space at comment (only when reading header) */
95+# int hcrc; /* true if there was or will be a header crc */
96+# int done; /* true when done reading gzip header (not used
97+# when writing a gzip file) */
98+# } gz_header;
99
100 Bytefp = ctypes.POINTER(ctypes.c_ubyte)
101
102@@ -84,24 +84,24 @@
103 ]
104
105
106-#/* Structure for decoding tables. Each entry provides either the
107-# information needed to do the operation requested by the code that
108-# indexed that table entry, or it provides a pointer to another
109-# table that indexes more bits of the code. op indicates whether
110-# the entry is a pointer to another table, a literal, a length or
111-# distance, an end-of-block, or an invalid code. For a table
112-# pointer, the low four bits of op is the number of index bits of
113-# that table. For a length or distance, the low four bits of op
114-# is the number of extra bits to get after the code. bits is
115-# the number of bits in this code or part of the code to drop off
116-# of the bit buffer. val is the actual byte to output in the case
117-# of a literal, the base length or distance, or the offset from
118-# the current table to the next table. Each entry is four bytes. */
119-#typedef struct {
120-# unsigned char op; /* operation, extra bits, table bits */
121-# unsigned char bits; /* bits in this part of the code */
122-# unsigned short val; /* offset in table or code value */
123-#} code;
124+# /* Structure for decoding tables. Each entry provides either the
125+# information needed to do the operation requested by the code that
126+# indexed that table entry, or it provides a pointer to another
127+# table that indexes more bits of the code. op indicates whether
128+# the entry is a pointer to another table, a literal, a length or
129+# distance, an end-of-block, or an invalid code. For a table
130+# pointer, the low four bits of op is the number of index bits of
131+# that table. For a length or distance, the low four bits of op
132+# is the number of extra bits to get after the code. bits is
133+# the number of bits in this code or part of the code to drop off
134+# of the bit buffer. val is the actual byte to output in the case
135+# of a literal, the base length or distance, or the offset from
136+# the current table to the next table. Each entry is four bytes. */
137+# typedef struct {
138+# unsigned char op; /* operation, extra bits, table bits */
139+# unsigned char bits; /* bits in this part of the code */
140+# unsigned short val; /* offset in table or code value */
141+# } code;
142
143 class Code(ctypes.Structure):
144 """code structure."""
145@@ -112,46 +112,47 @@
146 ('val', ctypes.c_ushort),
147 ]
148
149-#/* state maintained between inflate() calls. Approximately 7K bytes. */
150-#struct inflate_state {
151-# inflate_mode mode; /* current inflate mode */
152-# int last; /* true if processing last block */
153-# int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
154-# int havedict; /* true if dictionary provided */
155-# int flags; /* gzip header method and flags (0 if zlib) */
156-# unsigned dmax; /* zlib header max distance (INFLATE_STRICT)*/
157-# unsigned long check; /* protected copy of check value */
158-# unsigned long total; /* protected copy of output count */
159-# gz_headerp head; /* where to save gzip header information */
160-# /* sliding window */
161-# unsigned wbits; /* log base 2 of requested window size */
162-# unsigned wsize; /* window size or zero if not using window */
163-# unsigned whave; /* valid bytes in the window */
164-# unsigned write; /* window write index */
165-# unsigned char FAR *window; /* allocated sliding window, if needed */
166-# /* bit accumulator */
167-# unsigned long hold; /* input bit accumulator */
168-# unsigned bits; /* number of bits in "in" */
169-# /* for string and stored block copying */
170-# unsigned length; /* literal or length of data to copy */
171-# unsigned offset; /* distance back to copy string from */
172-# /* for table and code decoding */
173-# unsigned extra; /* extra bits needed */
174-# /* fixed and dynamic code tables */
175-# code const FAR *lencode; /* starting table for length/literal codes */
176-# code const FAR *distcode; /* starting table for distance codes */
177-# unsigned lenbits; /* index bits for lencode */
178-# unsigned distbits; /* index bits for distcode */
179-# /* dynamic table building */
180-# unsigned ncode; /* number of code length code lengths */
181-# unsigned nlen; /* number of length code lengths */
182-# unsigned ndist; /* number of distance code lengths */
183-# unsigned have; /* number of code lengths in lens[] */
184-# code FAR *next; /* next available space in codes[] */
185-# unsigned short lens[320]; /* temporary storage for code lengths */
186-# unsigned short work[288]; /* work area for code table building */
187-# code codes[ENOUGH]; /* space for code tables */
188-#};
189+# /* state maintained between inflate() calls. Approximately 7K bytes. */
190+# struct inflate_state {
191+# inflate_mode mode; /* current inflate mode */
192+# int last; /* true if processing last block */
193+# int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
194+# int havedict; /* true if dictionary provided */
195+# int flags; /* gzip header method and flags (0 if zlib) */
196+# unsigned dmax; /* zlib header max distance (INFLATE_STRICT)*/
197+# unsigned long check; /* protected copy of check value */
198+# unsigned long total; /* protected copy of output count */
199+# gz_headerp head; /* where to save gzip header information */
200+# /* sliding window */
201+# unsigned wbits; /* log base 2 of requested window size */
202+# unsigned wsize; /* window size or zero if not using window */
203+# unsigned whave; /* valid bytes in the window */
204+# unsigned write; /* window write index */
205+# unsigned char FAR *window; /* allocated sliding window, if needed */
206+# /* bit accumulator */
207+# unsigned long hold; /* input bit accumulator */
208+# unsigned bits; /* number of bits in "in" */
209+# /* for string and stored block copying */
210+# unsigned length; /* literal or length of data to copy */
211+# unsigned offset; /* distance back to copy string from */
212+# /* for table and code decoding */
213+# unsigned extra; /* extra bits needed */
214+# /* fixed and dynamic code tables */
215+# code const FAR *lencode; /* starting table for length/literal codes */
216+# code const FAR *distcode; /* starting table for distance codes */
217+# unsigned lenbits; /* index bits for lencode */
218+# unsigned distbits; /* index bits for distcode */
219+# /* dynamic table building */
220+# unsigned ncode; /* number of code length code lengths */
221+# unsigned nlen; /* number of length code lengths */
222+# unsigned ndist; /* number of distance code lengths */
223+# unsigned have; /* number of code lengths in lens[] */
224+# code FAR *next; /* next available space in codes[] */
225+# unsigned short lens[320]; /* temporary storage for code lengths */
226+# unsigned short work[288]; /* work area for code table building */
227+# code codes[ENOUGH]; /* space for code tables */
228+# };
229+
230 if zlib.ZLIB_VERSION == '1.2.3.4':
231 extra_fields = [
232 ('sane', ctypes.c_int),
233@@ -216,15 +217,15 @@
234 # head will be always a NULL pointer, as we use raw in/delfate
235 state = {}
236 # first get the pointers offsets
237- #lencode = ctypes.string_at(self.lencode, ctypes.sizeof(Code))
238+ # lencode = ctypes.string_at(self.lencode, ctypes.sizeof(Code))
239 lencode_addr = ctypes.addressof(self.lencode.contents)
240 codes_start = ctypes.addressof(self.codes)
241 lencode = lencode_addr - codes_start
242
243- #distcode = ctypes.string_at(self.distcode, ctypes.sizeof(Code))
244+ # distcode = ctypes.string_at(self.distcode, ctypes.sizeof(Code))
245 distcode = ctypes.addressof(self.distcode.contents) - codes_start
246
247- #next = ctypes.string_at(self.next, ctypes.sizeof(Code))
248+ # next = ctypes.string_at(self.next, ctypes.sizeof(Code))
249 next = ctypes.addressof(self.next.contents) - codes_start
250
251 # now get the raw memory data
252
253=== renamed file 'lib/ubuntuone/storage/tests/test_rhashlib.py' => 'src/server/tests/test_rhashlib.py'
254--- lib/ubuntuone/storage/tests/test_rhashlib.py 2015-08-05 13:10:02 +0000
255+++ src/server/tests/test_rhashlib.py 2015-09-05 01:20:53 +0000
256@@ -21,7 +21,7 @@
257 import hashlib
258 import unittest
259
260-from ubuntuone.storage import rhashlib
261+from ubuntuone.storage.server import rhashlib
262 from ubuntuone.storageprotocol.content_hash import magic_hash_factory
263
264
265
266=== renamed file 'lib/ubuntuone/storage/tests/test_rzlib.py' => 'src/server/tests/test_rzlib.py'
267--- lib/ubuntuone/storage/tests/test_rzlib.py 2015-08-05 13:10:02 +0000
268+++ src/server/tests/test_rzlib.py 2015-09-05 01:20:53 +0000
269@@ -23,7 +23,7 @@
270 import zlib
271 import unittest
272
273-from ubuntuone.storage import rzlib
274+from ubuntuone.storage.server import rzlib
275
276
277 class TestRZlib(unittest.TestCase):
278@@ -233,7 +233,7 @@
279 inflated_data += do.decompress(deflated_data[part:part * 2])
280 self.assertRaises(zlib.error, do.decompress, data[part * 2:])
281
282- ##### stdlib zlib tests #####
283+ # stdlib zlib tests #
284
285 def test_decompressobj_badflush(self):
286 """Verify failure on calling decompressobj.flush with bad params."""
287@@ -297,7 +297,7 @@
288 bufs = []
289 cb = combuf
290 while cb:
291- #max_length = 1 + len(cb)//10
292+ # max_length = 1 + len(cb)//10
293 chunk = dco.decompress(cb, dcx)
294 self.failIf(len(chunk) > dcx,
295 'chunk too big (%d>%d)' % (len(chunk), dcx))
296
297=== modified file 'src/server/tests/test_upload.py'
298--- src/server/tests/test_upload.py 2015-08-05 13:10:02 +0000
299+++ src/server/tests/test_upload.py 2015-09-05 01:20:53 +0000
300@@ -28,8 +28,7 @@
301 from s3lib import producers, s3lib
302 from s4 import s4
303
304-from ubuntuone.storage import rhashlib, rzlib
305-from ubuntuone.storage.server import upload, errors
306+from ubuntuone.storage.server import errors, rhashlib, rzlib, upload
307 from ubuntuone.storage.server.auth import DummyAuthProvider
308 from ubuntuone.storage.server.testing import testcase
309 from ubuntuone.storageprotocol.content_hash import (
310
311=== modified file 'src/server/upload.py'
312--- src/server/upload.py 2015-08-14 19:00:10 +0000
313+++ src/server/upload.py 2015-09-05 01:20:53 +0000
314@@ -42,8 +42,7 @@
315 crc32,
316 magic_hash_factory,
317 )
318-from ubuntuone.storage import rhashlib, rzlib
319-from ubuntuone.storage.server import errors
320+from ubuntuone.storage.server import errors, rhashlib, rzlib
321
322 logger = logging.getLogger("storage.server.upload")
323
324
325=== renamed directory 'lib/tests' => 'src/tests'
326=== renamed directory 'lib/ubuntuone/txutils' => 'src/txutils'
327=== renamed directory 'lib/utilities' => 'src/utilities'
328=== modified file 'src/utilities/load_sample_data.py'
329--- lib/utilities/load_sample_data.py 2015-08-05 13:10:02 +0000
330+++ src/utilities/load_sample_data.py 2015-09-05 01:20:53 +0000
331@@ -20,10 +20,6 @@
332 Called by the namesake in the top level utilities/ directory.
333 """
334
335-import warnings
336-#enjoy the silence
337-warnings.simplefilter("ignore")
338-
339 from utilities.userutils import (
340 add_auth_info_to_keyfile,
341 delete_all_data,
342@@ -48,7 +44,7 @@
343
344 def main():
345 """Preload the website with some data."""
346- #clear out existing data
347+ # clear out existing data
348 delete_all_data()
349 for user_data in SAMPLE_USERS:
350 username = user_data['username']

Subscribers

People subscribed via source and target branches

to all changes: