Merge lp:~ubuntu-branches/ubuntu/utopic/python-pyscss/utopic-201410021331 into lp:ubuntu/utopic/python-pyscss
- Utopic (14.10)
- utopic-201410021331
- Merge into utopic
Status: | Needs review |
---|---|
Proposed branch: | lp:~ubuntu-branches/ubuntu/utopic/python-pyscss/utopic-201410021331 |
Merge into: | lp:ubuntu/utopic/python-pyscss |
Diff against target: |
905 lines (+18/-726) 6 files modified
.pc/applied-patches (+0/-2) .pc/fixed-non-ascii-in-README.rst.patch/README.rst (+0/-55) .pc/python3-fixup.patch/scss/src/_speedups.c (+0/-554) README.rst (+1/-1) scss/src/_speedups.c (+17/-85) scss/src/py3defs.h (+0/-29) |
To merge this branch: | bzr merge lp:~ubuntu-branches/ubuntu/utopic/python-pyscss/utopic-201410021331 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+236878@code.launchpad.net |
Commit message
Description of the change
The package importer has detected a possible inconsistency between the package history in the archive and the history in bzr. As the archive is authoritative the importer has made lp:ubuntu/utopic/python-pyscss reflect what is in the archive and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/utopic/python-pyscss/utopic-201410021331. This merge proposal was created so that an Ubuntu developer can review the situations and perform a merge/upload if necessary. There are three typical cases where this can happen.
1. Where someone pushes a change to bzr and someone else uploads the package without that change. This is the reason that this check is done by the importer. If this appears to be the case then a merge/upload should be done if the changes that were in bzr are still desirable.
2. The importer incorrectly detected the above situation when someone made a change in bzr and then uploaded it.
3. The importer incorrectly detected the above situation when someone just uploaded a package and didn't touch bzr.
If this case doesn't appear to be the first situation then set the status of the merge proposal to "Rejected" and help avoid the problem in future by filing a bug at https:/
(this is an automatically generated message)
Unmerged revisions
- 8. By Chuck Short
-
* d/python-
pyscss. postrm: Removed due to Lintian error, and
python-pyscss. prerm already removes the alternative.
* d/python3-pyscss. postrm: Removed due to Lintian error, and
python3-pyscss. prerm already removes the alternative.
Preview Diff
1 | === removed file '.pc/applied-patches' |
2 | --- .pc/applied-patches 2014-09-24 21:54:24 +0000 |
3 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 |
4 | @@ -1,2 +0,0 @@ |
5 | -python3-fixup.patch |
6 | -fixed-non-ascii-in-README.rst.patch |
7 | |
8 | === removed directory '.pc/fixed-non-ascii-in-README.rst.patch' |
9 | === removed file '.pc/fixed-non-ascii-in-README.rst.patch/README.rst' |
10 | --- .pc/fixed-non-ascii-in-README.rst.patch/README.rst 2014-06-28 06:51:52 +0000 |
11 | +++ .pc/fixed-non-ascii-in-README.rst.patch/README.rst 1970-01-01 00:00:00 +0000 |
12 | @@ -1,55 +0,0 @@ |
13 | -pyScss, a Scss compiler for Python |
14 | -================================== |
15 | - |
16 | -pyScss is a compiler for SCSS flavor of the Sass language, a superset of CSS3 |
17 | -that adds programming capabilities and some other syntactic sugar. |
18 | - |
19 | -Quickstart |
20 | ----------- |
21 | - |
22 | -You need Python 2.6 or later. Python 3 is also supported. |
23 | - |
24 | -Installation:: |
25 | - |
26 | - pip install pyScss |
27 | - |
28 | -Usage:: |
29 | - |
30 | - python -mscss < style.scss |
31 | - |
32 | -Python API:: |
33 | - |
34 | - from scss import Scss |
35 | - compiler = Scss() |
36 | - compiler.compile("a { color: red + green; }") |
37 | - |
38 | - |
39 | -Features |
40 | --------- |
41 | - |
42 | -95% of Sass 3.2 is supported. If it's not supported, it's a bug! Please file |
43 | -a ticket. |
44 | - |
45 | -Most of Compass 0.11 is also built in. |
46 | - |
47 | - |
48 | -Further reading |
49 | ---------------- |
50 | - |
51 | -Documentation is in Sphinx. You can build it yourself by running ``make html`` |
52 | -from within the ``docs`` directory, or read it on RTD: |
53 | -http://pyscss.readthedocs.org/en/latest/ |
54 | - |
55 | -The canonical syntax reference is part of the Ruby Sass documentation: |
56 | -http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html |
57 | - |
58 | - |
59 | -Obligatory |
60 | ----------- |
61 | - |
62 | -Copyright © 2012 German M. Bravo (Kronuz). Additional credits in the |
63 | -documentation. |
64 | - |
65 | -Licensed under the `MIT license`_, reproduced in ``LICENSE``. |
66 | - |
67 | -.. _MIT license: http://www.opensource.org/licenses/mit-license.php |
68 | |
69 | === removed directory '.pc/python3-fixup.patch' |
70 | === removed directory '.pc/python3-fixup.patch/scss' |
71 | === removed directory '.pc/python3-fixup.patch/scss/src' |
72 | === removed file '.pc/python3-fixup.patch/scss/src/_speedups.c' |
73 | --- .pc/python3-fixup.patch/scss/src/_speedups.c 2014-06-26 12:10:36 +0000 |
74 | +++ .pc/python3-fixup.patch/scss/src/_speedups.c 1970-01-01 00:00:00 +0000 |
75 | @@ -1,554 +0,0 @@ |
76 | -/* |
77 | -* pyScss, a Scss compiler for Python |
78 | -* SCSS blocks scanner. |
79 | -* |
80 | -* German M. Bravo (Kronuz) <german.mb@gmail.com> |
81 | -* https://github.com/Kronuz/pyScss |
82 | -* |
83 | -* MIT license (http://www.opensource.org/licenses/mit-license.php) |
84 | -* Copyright (c) 2011 German M. Bravo (Kronuz), All rights reserved. |
85 | -*/ |
86 | -#include <Python.h> |
87 | -#include "block_locator.h" |
88 | -#include "scanner.h" |
89 | - |
90 | -/* BlockLocator */ |
91 | -staticforward PyTypeObject scss_BlockLocatorType; |
92 | - |
93 | -typedef struct { |
94 | - PyObject_HEAD |
95 | - BlockLocator *locator; |
96 | -} scss_BlockLocator; |
97 | - |
98 | -static int |
99 | -scss_BlockLocator_init(scss_BlockLocator *self, PyObject *args, PyObject *kwds) |
100 | -{ |
101 | - char *codestr; |
102 | - int codestr_sz; |
103 | - |
104 | - self->locator = NULL; |
105 | - |
106 | - if (!PyArg_ParseTuple(args, "s#", &codestr, &codestr_sz)) { |
107 | - return -1; |
108 | - } |
109 | - |
110 | - self->locator = BlockLocator_new(codestr, codestr_sz); |
111 | - |
112 | - #ifdef DEBUG |
113 | - PySys_WriteStderr("Scss BlockLocator object initialized! (%lu bytes)\n", sizeof(scss_BlockLocator)); |
114 | - #endif |
115 | - |
116 | - return 0; |
117 | -} |
118 | - |
119 | -static void |
120 | -scss_BlockLocator_dealloc(scss_BlockLocator *self) |
121 | -{ |
122 | - if (self->locator != NULL) BlockLocator_del(self->locator); |
123 | - |
124 | - self->ob_type->tp_free((PyObject*)self); |
125 | - |
126 | - #ifdef DEBUG |
127 | - PySys_WriteStderr("Scss BlockLocator object destroyed!\n"); |
128 | - #endif |
129 | -} |
130 | - |
131 | -scss_BlockLocator* |
132 | -scss_BlockLocator_iter(scss_BlockLocator *self) |
133 | -{ |
134 | - Py_INCREF(self); |
135 | - return self; |
136 | -} |
137 | - |
138 | -PyObject* |
139 | -scss_BlockLocator_iternext(scss_BlockLocator *self) |
140 | -{ |
141 | - Block *block; |
142 | - |
143 | - if (self->locator != NULL) { |
144 | - block = BlockLocator_iternext(self->locator); |
145 | - |
146 | - if (block->error > 0) { |
147 | - return Py_BuildValue( |
148 | - "is#s#", |
149 | - block->lineno, |
150 | - block->selprop, |
151 | - block->selprop_sz, |
152 | - block->codestr, |
153 | - block->codestr_sz |
154 | - ); |
155 | - } |
156 | - |
157 | - if (block->error > 0) { |
158 | - PyErr_SetString(PyExc_Exception, self->locator->exc); |
159 | - return NULL; |
160 | - } |
161 | - } |
162 | - |
163 | - /* Raising of standard StopIteration exception with empty value. */ |
164 | - PyErr_SetNone(PyExc_StopIteration); |
165 | - return NULL; |
166 | -} |
167 | - |
168 | -/* Type definition */ |
169 | - |
170 | -static PyTypeObject scss_BlockLocatorType = { |
171 | - PyObject_HEAD_INIT(NULL) |
172 | - 0, /* ob_size */ |
173 | - "scss._BlockLocator", /* tp_name */ |
174 | - sizeof(scss_BlockLocator), /* tp_basicsize */ |
175 | - 0, /* tp_itemsize */ |
176 | - (destructor)scss_BlockLocator_dealloc, /* tp_dealloc */ |
177 | - 0, /* tp_print */ |
178 | - 0, /* tp_getattr */ |
179 | - 0, /* tp_setattr */ |
180 | - 0, /* tp_compare */ |
181 | - 0, /* tp_repr */ |
182 | - 0, /* tp_as_number */ |
183 | - 0, /* tp_as_sequence */ |
184 | - 0, /* tp_as_mapping */ |
185 | - 0, /* tp_hash */ |
186 | - 0, /* tp_call */ |
187 | - 0, /* tp_str */ |
188 | - 0, /* tp_getattro */ |
189 | - 0, /* tp_setattro */ |
190 | - 0, /* tp_as_buffer */ |
191 | - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /* tp_flags */ |
192 | - "Internal BlockLocator iterator object.", /* tp_doc */ |
193 | - 0, /* tp_traverse */ |
194 | - 0, /* tp_clear */ |
195 | - 0, /* tp_richcompare */ |
196 | - 0, /* tp_weaklistoffset */ |
197 | - (getiterfunc)scss_BlockLocator_iter, /* tp_iter: __iter__() method */ |
198 | - (iternextfunc)scss_BlockLocator_iternext, /* tp_iternext: next() method */ |
199 | - 0, /* tp_methods */ |
200 | - 0, /* tp_members */ |
201 | - 0, /* tp_getset */ |
202 | - 0, /* tp_base */ |
203 | - 0, /* tp_dict */ |
204 | - 0, /* tp_descr_get */ |
205 | - 0, /* tp_descr_set */ |
206 | - 0, /* tp_dictoffset */ |
207 | - (initproc)scss_BlockLocator_init, /* tp_init */ |
208 | -}; |
209 | - |
210 | - |
211 | -/* Scanner */ |
212 | -static PyObject *PyExc_scss_NoMoreTokens; |
213 | - |
214 | -staticforward PyTypeObject scss_ScannerType; |
215 | - |
216 | -typedef struct { |
217 | - PyObject_HEAD |
218 | - Scanner *scanner; |
219 | -} scss_Scanner; |
220 | - |
221 | - |
222 | -static PyObject * |
223 | -scss_Scanner_rewind(scss_Scanner *self, PyObject *args) |
224 | -{ |
225 | - int token_num; |
226 | - if (self->scanner != NULL) { |
227 | - if (PyArg_ParseTuple(args, "i", &token_num)) { |
228 | - Scanner_rewind(self->scanner, token_num); |
229 | - } |
230 | - } |
231 | - Py_INCREF(Py_None); |
232 | - return (PyObject *)Py_None; |
233 | -} |
234 | - |
235 | - |
236 | -static PyObject * |
237 | -scss_Scanner_token(scss_Scanner *self, PyObject *args) |
238 | -{ |
239 | - PyObject *iter; |
240 | - PyObject *item; |
241 | - long size; |
242 | - |
243 | - Token *p_token; |
244 | - |
245 | - int token_num; |
246 | - PyObject *restrictions = NULL; |
247 | - Pattern *_restrictions = NULL; |
248 | - int restrictions_sz = 0; |
249 | - if (self->scanner != NULL) { |
250 | - if (PyArg_ParseTuple(args, "i|O", &token_num, &restrictions)) { |
251 | - if (restrictions != NULL) { |
252 | - size = PySequence_Size(restrictions); |
253 | - if (size != -1) { |
254 | - _restrictions = PyMem_New(Pattern, size); |
255 | - iter = PyObject_GetIter(restrictions); |
256 | - while ((item = PyIter_Next(iter))) { |
257 | - if (PyString_Check(item)) { |
258 | - _restrictions[restrictions_sz].tok = PyString_AsString(item); |
259 | - _restrictions[restrictions_sz].expr = NULL; |
260 | - restrictions_sz++; |
261 | - } |
262 | - Py_DECREF(item); |
263 | - } |
264 | - Py_DECREF(iter); |
265 | - } |
266 | - } |
267 | - p_token = Scanner_token(self->scanner, token_num, _restrictions, restrictions_sz); |
268 | - |
269 | - if (_restrictions != NULL) PyMem_Del(_restrictions); |
270 | - |
271 | - if (p_token == (Token *)SCANNER_EXC_BAD_TOKEN) { |
272 | - PyErr_SetString(PyExc_SyntaxError, self->scanner->exc); |
273 | - return NULL; |
274 | - } |
275 | - if (p_token == (Token *)SCANNER_EXC_RESTRICTED) { |
276 | - PyErr_SetString(PyExc_SyntaxError, self->scanner->exc); |
277 | - return NULL; |
278 | - } |
279 | - if (p_token == (Token *)SCANNER_EXC_UNIMPLEMENTED) { |
280 | - PyErr_SetString(PyExc_NotImplementedError, self->scanner->exc); |
281 | - return NULL; |
282 | - } |
283 | - if (p_token == (Token *)SCANNER_EXC_NO_MORE_TOKENS) { |
284 | - PyErr_SetNone(PyExc_scss_NoMoreTokens); |
285 | - return NULL; |
286 | - } |
287 | - if (p_token < 0) { |
288 | - PyErr_SetNone(PyExc_Exception); |
289 | - return NULL; |
290 | - } |
291 | - return Py_BuildValue( |
292 | - "iiss#", |
293 | - p_token->string - self->scanner->input, |
294 | - p_token->string - self->scanner->input + p_token->string_sz, |
295 | - p_token->regex->tok, |
296 | - p_token->string, |
297 | - p_token->string_sz |
298 | - ); |
299 | - } |
300 | - } |
301 | - Py_INCREF(Py_None); |
302 | - return (PyObject *)Py_None; |
303 | -} |
304 | - |
305 | -static PyObject * |
306 | -scss_Scanner_reset(scss_Scanner *self, PyObject *args, PyObject *kwds) |
307 | -{ |
308 | - char *input = NULL; |
309 | - int input_sz = 0; |
310 | - |
311 | - if (self->scanner != NULL) { |
312 | - if (PyArg_ParseTuple(args, "|z#", &input, &input_sz)) { |
313 | - Scanner_reset(self->scanner, input, input_sz); |
314 | - } |
315 | - } |
316 | - |
317 | - Py_INCREF(Py_None); |
318 | - return (PyObject *)Py_None; |
319 | -} |
320 | - |
321 | -static PyObject * |
322 | -scss_Scanner_setup_patterns(PyObject *self, PyObject *patterns) |
323 | -{ |
324 | - PyObject *item, *item0, *item1; |
325 | - int i, is_tuple, _is_tuple; |
326 | - long size; |
327 | - |
328 | - Pattern *_patterns = NULL; |
329 | - int patterns_sz = 0; |
330 | - if (!Scanner_initialized()) { |
331 | - is_tuple = PyTuple_Check(patterns); |
332 | - if (is_tuple || PyList_Check(patterns)) { |
333 | - size = is_tuple ? PyTuple_Size(patterns) : PyList_Size(patterns); |
334 | - _patterns = PyMem_New(Pattern, size); |
335 | - for (i = 0; i < size; ++i) { |
336 | - item = is_tuple ? PyTuple_GetItem(patterns, i) : PyList_GetItem(patterns, i); |
337 | - _is_tuple = PyTuple_Check(item); |
338 | - if (_is_tuple || PyList_Check(item)) { |
339 | - item0 = _is_tuple ? PyTuple_GetItem(item, 0) : PyList_GetItem(item, 0); |
340 | - item1 = _is_tuple ? PyTuple_GetItem(item, 1) : PyList_GetItem(item, 1); |
341 | - if (PyString_Check(item0) && PyString_Check(item1)) { |
342 | - _patterns[patterns_sz].tok = PyString_AsString(item0); |
343 | - _patterns[patterns_sz].expr = PyString_AsString(item1); |
344 | - patterns_sz++; |
345 | - } |
346 | - } |
347 | - } |
348 | - } |
349 | - Scanner_initialize(_patterns, patterns_sz); |
350 | - if (_patterns != NULL) PyMem_Del(_patterns); |
351 | - } |
352 | - Py_INCREF(Py_None); |
353 | - return (PyObject *)Py_None; |
354 | -} |
355 | - |
356 | -static int |
357 | -scss_Scanner_init(scss_Scanner *self, PyObject *args, PyObject *kwds) |
358 | -{ |
359 | - PyObject *item, *item0, *item1; |
360 | - int i, is_tuple, _is_tuple; |
361 | - long size; |
362 | - |
363 | - PyObject *patterns, *ignore; |
364 | - Pattern *_patterns = NULL; |
365 | - int patterns_sz = 0; |
366 | - Pattern *_ignore = NULL; |
367 | - int ignore_sz = 0; |
368 | - char *input = NULL; |
369 | - int input_sz = 0; |
370 | - |
371 | - self->scanner = NULL; |
372 | - |
373 | - if (!PyArg_ParseTuple(args, "OO|z#", &patterns, &ignore, &input, &input_sz)) { |
374 | - return -1; |
375 | - } |
376 | - |
377 | - if (!Scanner_initialized()) { |
378 | - is_tuple = PyTuple_Check(patterns); |
379 | - if (is_tuple || PyList_Check(patterns)) { |
380 | - size = is_tuple ? PyTuple_Size(patterns) : PyList_Size(patterns); |
381 | - _patterns = PyMem_New(Pattern, size); |
382 | - for (i = 0; i < size; ++i) { |
383 | - item = is_tuple ? PyTuple_GetItem(patterns, i) : PyList_GetItem(patterns, i); |
384 | - _is_tuple = PyTuple_Check(item); |
385 | - if (_is_tuple || PyList_Check(item)) { |
386 | - item0 = _is_tuple ? PyTuple_GetItem(item, 0) : PyList_GetItem(item, 0); |
387 | - item1 = _is_tuple ? PyTuple_GetItem(item, 1) : PyList_GetItem(item, 1); |
388 | - if (PyString_Check(item0) && PyString_Check(item1)) { |
389 | - _patterns[patterns_sz].tok = PyString_AsString(item0); |
390 | - _patterns[patterns_sz].expr = PyString_AsString(item1); |
391 | - patterns_sz++; |
392 | - } |
393 | - } |
394 | - } |
395 | - } |
396 | - Scanner_initialize(_patterns, patterns_sz); |
397 | - } |
398 | - |
399 | - is_tuple = PyTuple_Check(ignore); |
400 | - if (is_tuple || PyList_Check(ignore)) { |
401 | - size = is_tuple ? PyTuple_Size(ignore) : PyList_Size(ignore); |
402 | - _ignore = PyMem_New(Pattern, size); |
403 | - for (i = 0; i < size; ++i) { |
404 | - item = is_tuple ? PyTuple_GetItem(ignore, i) : PyList_GetItem(ignore, i); |
405 | - if (PyString_Check(item)) { |
406 | - _ignore[ignore_sz].tok = PyString_AsString(item); |
407 | - _ignore[ignore_sz].expr = NULL; |
408 | - ignore_sz++; |
409 | - } |
410 | - } |
411 | - } |
412 | - |
413 | - self->scanner = Scanner_new(_patterns, patterns_sz, _ignore, ignore_sz, input, input_sz); |
414 | - |
415 | - if (_patterns != NULL) PyMem_Del(_patterns); |
416 | - if (_ignore != NULL) PyMem_Del(_ignore); |
417 | - |
418 | - #ifdef DEBUG |
419 | - PySys_WriteStderr("Scss Scanner object initialized! (%lu bytes)\n", sizeof(scss_Scanner)); |
420 | - #endif |
421 | - |
422 | - return 0; |
423 | -} |
424 | - |
425 | -static PyObject * |
426 | -scss_Scanner_repr(scss_Scanner *self) |
427 | -{ |
428 | - /* Print the last 10 tokens that have been scanned in */ |
429 | - PyObject *repr, *tmp; |
430 | - Token *p_token; |
431 | - int i, start, pos; |
432 | - |
433 | - if (self->scanner != NULL && self->scanner->tokens_sz) { |
434 | - start = self->scanner->tokens_sz - 10; |
435 | - repr = PyString_FromString(""); |
436 | - for (i = (start < 0) ? 0 : start; i < self->scanner->tokens_sz; i++) { |
437 | - p_token = &self->scanner->tokens[i]; |
438 | - PyString_ConcatAndDel(&repr, PyString_FromString("\n")); |
439 | - pos = (int)(p_token->string - self->scanner->input); |
440 | - PyString_ConcatAndDel(&repr, PyString_FromFormat(" (@%d) %s = ", |
441 | - pos, p_token->regex->tok)); |
442 | - tmp = PyString_FromStringAndSize(p_token->string, p_token->string_sz); |
443 | - PyString_ConcatAndDel(&repr, PyObject_Repr(tmp)); |
444 | - Py_XDECREF(tmp); |
445 | - } |
446 | - } else { |
447 | - repr = PyString_FromString("None"); |
448 | - } |
449 | - |
450 | - return (PyObject *)repr; |
451 | - |
452 | -/* |
453 | - PyObject *repr, *tmp, *tmp2; |
454 | - Token *p_token; |
455 | - char *tok; |
456 | - int i, start, first = 1, cur, max=0, pos; |
457 | - |
458 | - if (self->scanner != NULL && self->scanner->tokens_sz) { |
459 | - start = self->scanner->tokens_sz - 10; |
460 | - repr = PyString_FromString(""); |
461 | - for (i = (start < 0) ? 0 : start; i < self->scanner->tokens_sz; i++) { |
462 | - p_token = self->scanner->tokens[i]; |
463 | - PyString_ConcatAndDel(&repr, PyString_FromString("\n")); |
464 | - pos = (int)(p_token->string - self->scanner->input); |
465 | - PyString_ConcatAndDel(&repr, PyString_FromFormat(" (@%d) %s = ", |
466 | - pos, p_token->regex->tok)); |
467 | - tmp = PyString_FromString(p_token->string); |
468 | - PyString_ConcatAndDel(&repr, PyObject_Repr(tmp)); |
469 | - Py_XDECREF(tmp); |
470 | - } |
471 | - |
472 | - start = self->scanner->tokens_sz - 10; |
473 | - for (i = (start < 0) ? 0 : start; i < self->scanner->tokens_sz; i++) { |
474 | - p_token = self->scanner->tokens[i]; |
475 | - cur = strlen(p_token->regex->tok) * 2; |
476 | - if (cur > max) max = cur; |
477 | - } |
478 | - tok = PyMem_New(char, max + 4); |
479 | - repr = PyString_FromString(""); |
480 | - for (i = (start < 0) ? 0 : start; i < self->scanner->tokens_sz; i++) { |
481 | - p_token = self->scanner->tokens[i]; |
482 | - if (!first) PyString_ConcatAndDel(&repr, PyString_FromString("\n")); |
483 | - |
484 | - pos = (int)(p_token->string - self->scanner->input); |
485 | - if (pos < 10) PyString_ConcatAndDel(&repr, PyString_FromString(" ")); |
486 | - if (pos < 100) PyString_ConcatAndDel(&repr, PyString_FromString(" ")); |
487 | - if (pos < 1000) PyString_ConcatAndDel(&repr, PyString_FromString(" ")); |
488 | - PyString_ConcatAndDel(&repr, PyString_FromFormat("(@%d) ", |
489 | - pos)); |
490 | - |
491 | - tmp = PyString_FromString(p_token->regex->tok); |
492 | - tmp2 = PyObject_Repr(tmp); |
493 | - memset(tok, ' ', max + 4); |
494 | - tok[max + 3 - PyString_Size(tmp2)] = '\0'; |
495 | - PyString_ConcatAndDel(&repr, PyString_FromString(tok)); |
496 | - PyString_ConcatAndDel(&repr, tmp2); |
497 | - Py_XDECREF(tmp); |
498 | - |
499 | - PyString_ConcatAndDel(&repr, PyString_FromString(" = ")); |
500 | - tmp = PyString_FromString(p_token->string); |
501 | - PyString_ConcatAndDel(&repr, PyObject_Repr(tmp)); |
502 | - Py_XDECREF(tmp); |
503 | - |
504 | - first = 0; |
505 | - } |
506 | - PyMem_Del(tok); |
507 | - } else { |
508 | - repr = PyString_FromString("None"); |
509 | - } |
510 | - |
511 | - return (PyObject *)repr; |
512 | -*/ |
513 | -} |
514 | - |
515 | -static void |
516 | -scss_Scanner_dealloc(scss_Scanner *self) |
517 | -{ |
518 | - if (self->scanner != NULL) Scanner_del(self->scanner); |
519 | - |
520 | - self->ob_type->tp_free((PyObject*)self); |
521 | - |
522 | - #ifdef DEBUG |
523 | - PySys_WriteStderr("Scss Scanner object destroyed!\n"); |
524 | - #endif |
525 | -} |
526 | - |
527 | -static PyMethodDef scss_Scanner_methods[] = { |
528 | - {"reset", (PyCFunction)scss_Scanner_reset, METH_VARARGS, "Scan the next token"}, |
529 | - {"token", (PyCFunction)scss_Scanner_token, METH_VARARGS, "Get the nth token"}, |
530 | - {"rewind", (PyCFunction)scss_Scanner_rewind, METH_VARARGS, "Rewind scanner"}, |
531 | - {"setup_patterns", (PyCFunction)scss_Scanner_setup_patterns, METH_O | METH_STATIC, "Initialize patterns."}, |
532 | - {NULL, NULL, 0, NULL} /* Sentinel */ |
533 | -}; |
534 | - |
535 | -static PyTypeObject scss_ScannerType = { |
536 | - PyObject_HEAD_INIT(NULL) |
537 | - 0, /* ob_size */ |
538 | - "scss.Scanner", /* tp_name */ |
539 | - sizeof(scss_Scanner), /* tp_basicsize */ |
540 | - 0, /* tp_itemsize */ |
541 | - (destructor)scss_Scanner_dealloc, /* tp_dealloc */ |
542 | - 0, /* tp_print */ |
543 | - 0, /* tp_getattr */ |
544 | - 0, /* tp_setattr */ |
545 | - 0, /* tp_compare */ |
546 | - (reprfunc)scss_Scanner_repr, /* tp_repr */ |
547 | - 0, /* tp_as_number */ |
548 | - 0, /* tp_as_sequence */ |
549 | - 0, /* tp_as_mapping */ |
550 | - 0, /* tp_hash */ |
551 | - 0, /* tp_call */ |
552 | - 0, /* tp_str */ |
553 | - 0, /* tp_getattro */ |
554 | - 0, /* tp_setattro */ |
555 | - 0, /* tp_as_buffer */ |
556 | - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ |
557 | - "Scanner object.", /* tp_doc */ |
558 | - 0, /* tp_traverse */ |
559 | - 0, /* tp_clear */ |
560 | - 0, /* tp_richcompare */ |
561 | - 0, /* tp_weaklistoffset */ |
562 | - 0, /* tp_iter: __iter__() method */ |
563 | - 0, /* tp_iternext: next() method */ |
564 | - scss_Scanner_methods, /* tp_methods */ |
565 | - 0, /* tp_members */ |
566 | - 0, /* tp_getset */ |
567 | - 0, /* tp_base */ |
568 | - 0, /* tp_dict */ |
569 | - 0, /* tp_descr_get */ |
570 | - 0, /* tp_descr_set */ |
571 | - 0, /* tp_dictoffset */ |
572 | - (initproc)scss_Scanner_init, /* tp_init */ |
573 | -}; |
574 | - |
575 | - |
576 | -/* Python constructor */ |
577 | - |
578 | -static PyObject * |
579 | -scss_locate_blocks(PyObject *self, PyObject *args) |
580 | -{ |
581 | - scss_BlockLocator *result = NULL; |
582 | - |
583 | - result = PyObject_New(scss_BlockLocator, &scss_BlockLocatorType); |
584 | - if (result) { |
585 | - scss_BlockLocator_init(result, args, NULL); |
586 | - } |
587 | - |
588 | - return (PyObject *)result; |
589 | -} |
590 | - |
591 | - |
592 | -/* Module functions */ |
593 | - |
594 | -static PyMethodDef scss_methods[] = { |
595 | - {"locate_blocks", (PyCFunction)scss_locate_blocks, METH_VARARGS, "Locate Scss blocks."}, |
596 | - {NULL, NULL, 0, NULL} /* Sentinel */ |
597 | -}; |
598 | - |
599 | - |
600 | -/* Module init function */ |
601 | - |
602 | -PyMODINIT_FUNC |
603 | -init_speedups(void) |
604 | -{ |
605 | - PyObject* m; |
606 | - |
607 | - scss_BlockLocatorType.tp_new = PyType_GenericNew; |
608 | - if (PyType_Ready(&scss_BlockLocatorType) < 0) |
609 | - return; |
610 | - |
611 | - scss_ScannerType.tp_new = PyType_GenericNew; |
612 | - if (PyType_Ready(&scss_ScannerType) < 0) |
613 | - return; |
614 | - |
615 | - BlockLocator_initialize(); |
616 | - Scanner_initialize(NULL, 0); |
617 | - |
618 | - m = Py_InitModule("_speedups", scss_methods); |
619 | - |
620 | - Py_INCREF(&scss_BlockLocatorType); |
621 | - PyModule_AddObject(m, "_BlockLocator", (PyObject *)&scss_BlockLocatorType); |
622 | - |
623 | - Py_INCREF(&scss_ScannerType); |
624 | - PyModule_AddObject(m, "Scanner", (PyObject *)&scss_ScannerType); |
625 | - |
626 | - PyExc_scss_NoMoreTokens = PyErr_NewException("_speedups.NoMoreTokens", NULL, NULL); |
627 | - Py_INCREF(PyExc_scss_NoMoreTokens); |
628 | - PyModule_AddObject(m, "NoMoreTokens", (PyObject *)PyExc_scss_NoMoreTokens); |
629 | -} |
630 | |
631 | === removed file '.pc/python3-fixup.patch/scss/src/py3defs.h' |
632 | === modified file 'README.rst' |
633 | --- README.rst 2014-06-28 06:51:52 +0000 |
634 | +++ README.rst 2014-10-02 13:40:33 +0000 |
635 | @@ -47,7 +47,7 @@ |
636 | Obligatory |
637 | ---------- |
638 | |
639 | -Copyright (c) 2012 German M. Bravo (Kronuz). Additional credits in the |
640 | +Copyright © 2012 German M. Bravo (Kronuz). Additional credits in the |
641 | documentation. |
642 | |
643 | Licensed under the `MIT license`_, reproduced in ``LICENSE``. |
644 | |
645 | === modified file 'scss/src/_speedups.c' |
646 | --- scss/src/_speedups.c 2014-09-17 11:11:52 +0000 |
647 | +++ scss/src/_speedups.c 2014-10-02 13:40:33 +0000 |
648 | @@ -9,12 +9,11 @@ |
649 | * Copyright (c) 2011 German M. Bravo (Kronuz), All rights reserved. |
650 | */ |
651 | #include <Python.h> |
652 | -#include "py3defs.h" |
653 | #include "block_locator.h" |
654 | #include "scanner.h" |
655 | |
656 | /* BlockLocator */ |
657 | -static PyTypeObject scss_BlockLocatorType; |
658 | +staticforward PyTypeObject scss_BlockLocatorType; |
659 | |
660 | typedef struct { |
661 | PyObject_HEAD |
662 | @@ -47,7 +46,7 @@ |
663 | { |
664 | if (self->locator != NULL) BlockLocator_del(self->locator); |
665 | |
666 | - Py_TYPE(self)->tp_free((PyObject*)self); |
667 | + self->ob_type->tp_free((PyObject*)self); |
668 | |
669 | #ifdef DEBUG |
670 | PySys_WriteStderr("Scss BlockLocator object destroyed!\n"); |
671 | @@ -94,7 +93,8 @@ |
672 | /* Type definition */ |
673 | |
674 | static PyTypeObject scss_BlockLocatorType = { |
675 | - PyVarObject_HEAD_INIT(NULL, 0) |
676 | + PyObject_HEAD_INIT(NULL) |
677 | + 0, /* ob_size */ |
678 | "scss._BlockLocator", /* tp_name */ |
679 | sizeof(scss_BlockLocator), /* tp_basicsize */ |
680 | 0, /* tp_itemsize */ |
681 | @@ -136,7 +136,7 @@ |
682 | /* Scanner */ |
683 | static PyObject *PyExc_scss_NoMoreTokens; |
684 | |
685 | -static PyTypeObject scss_ScannerType; |
686 | +staticforward PyTypeObject scss_ScannerType; |
687 | |
688 | typedef struct { |
689 | PyObject_HEAD |
690 | @@ -179,13 +179,8 @@ |
691 | _restrictions = PyMem_New(Pattern, size); |
692 | iter = PyObject_GetIter(restrictions); |
693 | while ((item = PyIter_Next(iter))) { |
694 | -#if PY_MAJOR_VERSION >= 3 |
695 | - if (PyBytes_Check(item)) { |
696 | - _restrictions[restrictions_sz].tok = PyBytes_AsString(item); |
697 | -#else |
698 | if (PyString_Check(item)) { |
699 | _restrictions[restrictions_sz].tok = PyString_AsString(item); |
700 | -#endif |
701 | _restrictions[restrictions_sz].expr = NULL; |
702 | restrictions_sz++; |
703 | } |
704 | @@ -268,15 +263,9 @@ |
705 | if (_is_tuple || PyList_Check(item)) { |
706 | item0 = _is_tuple ? PyTuple_GetItem(item, 0) : PyList_GetItem(item, 0); |
707 | item1 = _is_tuple ? PyTuple_GetItem(item, 1) : PyList_GetItem(item, 1); |
708 | -#if PY_MAJOR_VERSION >= 3 |
709 | - if (PyBytes_Check(item0) && PyBytes_Check(item1)) { |
710 | - _patterns[patterns_sz].tok = PyBytes_AsString(item0); |
711 | - _patterns[patterns_sz].expr = PyBytes_AsString(item1); |
712 | -#else |
713 | if (PyString_Check(item0) && PyString_Check(item1)) { |
714 | _patterns[patterns_sz].tok = PyString_AsString(item0); |
715 | _patterns[patterns_sz].expr = PyString_AsString(item1); |
716 | -#endif |
717 | patterns_sz++; |
718 | } |
719 | } |
720 | @@ -321,15 +310,9 @@ |
721 | if (_is_tuple || PyList_Check(item)) { |
722 | item0 = _is_tuple ? PyTuple_GetItem(item, 0) : PyList_GetItem(item, 0); |
723 | item1 = _is_tuple ? PyTuple_GetItem(item, 1) : PyList_GetItem(item, 1); |
724 | -#if PY_MAJOR_VERSION >= 3 |
725 | - if (PyBytes_Check(item0) && PyBytes_Check(item1)) { |
726 | - _patterns[patterns_sz].tok = PyBytes_AsString(item0); |
727 | - _patterns[patterns_sz].expr = PyBytes_AsString(item1); |
728 | -#else |
729 | if (PyString_Check(item0) && PyString_Check(item1)) { |
730 | _patterns[patterns_sz].tok = PyString_AsString(item0); |
731 | _patterns[patterns_sz].expr = PyString_AsString(item1); |
732 | -#endif |
733 | patterns_sz++; |
734 | } |
735 | } |
736 | @@ -344,13 +327,8 @@ |
737 | _ignore = PyMem_New(Pattern, size); |
738 | for (i = 0; i < size; ++i) { |
739 | item = is_tuple ? PyTuple_GetItem(ignore, i) : PyList_GetItem(ignore, i); |
740 | -#if PY_MAJOR_VERSION >= 3 |
741 | - if (PyBytes_Check(item)) { |
742 | - _ignore[ignore_sz].tok = PyBytes_AsString(item); |
743 | -#else |
744 | if (PyString_Check(item)) { |
745 | _ignore[ignore_sz].tok = PyString_AsString(item); |
746 | -#endif |
747 | _ignore[ignore_sz].expr = NULL; |
748 | ignore_sz++; |
749 | } |
750 | @@ -379,22 +357,6 @@ |
751 | |
752 | if (self->scanner != NULL && self->scanner->tokens_sz) { |
753 | start = self->scanner->tokens_sz - 10; |
754 | -#if PY_MAJOR_VERSION >= 3 |
755 | - repr = PyBytes_FromString(""); |
756 | - for (i = (start < 0) ? 0 : start; i < self->scanner->tokens_sz; i++) { |
757 | - p_token = &self->scanner->tokens[i]; |
758 | - PyBytes_ConcatAndDel(&repr, PyBytes_FromString("\n")); |
759 | - pos = (int)(p_token->string - self->scanner->input); |
760 | - PyBytes_ConcatAndDel(&repr, PyBytes_FromFormat(" (@%d) %s = ", |
761 | - pos, p_token->regex->tok)); |
762 | - tmp = PyBytes_FromStringAndSize(p_token->string, p_token->string_sz); |
763 | - PyBytes_ConcatAndDel(&repr, PyObject_Repr(tmp)); |
764 | - Py_XDECREF(tmp); |
765 | - } |
766 | - } else { |
767 | - repr = PyBytes_FromString("None"); |
768 | - } |
769 | -#else |
770 | repr = PyString_FromString(""); |
771 | for (i = (start < 0) ? 0 : start; i < self->scanner->tokens_sz; i++) { |
772 | p_token = &self->scanner->tokens[i]; |
773 | @@ -409,7 +371,6 @@ |
774 | } else { |
775 | repr = PyString_FromString("None"); |
776 | } |
777 | -#endif |
778 | |
779 | return (PyObject *)repr; |
780 | |
781 | @@ -481,7 +442,7 @@ |
782 | { |
783 | if (self->scanner != NULL) Scanner_del(self->scanner); |
784 | |
785 | - Py_TYPE(self)->tp_free((PyObject*)self); |
786 | + self->ob_type->tp_free((PyObject*)self); |
787 | |
788 | #ifdef DEBUG |
789 | PySys_WriteStderr("Scss Scanner object destroyed!\n"); |
790 | @@ -497,7 +458,8 @@ |
791 | }; |
792 | |
793 | static PyTypeObject scss_ScannerType = { |
794 | - PyVarObject_HEAD_INIT(NULL, 0) |
795 | + PyObject_HEAD_INIT(NULL) |
796 | + 0, /* ob_size */ |
797 | "scss.Scanner", /* tp_name */ |
798 | sizeof(scss_Scanner), /* tp_basicsize */ |
799 | 0, /* tp_itemsize */ |
800 | @@ -559,53 +521,27 @@ |
801 | {NULL, NULL, 0, NULL} /* Sentinel */ |
802 | }; |
803 | |
804 | -#if PY_MAJOR_VERSION >= 3 |
805 | - |
806 | -/* Module definition */ |
807 | - |
808 | -static struct PyModuleDef speedups_module_def = { |
809 | - PyModuleDef_HEAD_INIT, |
810 | - "_speedups", /* m_name */ |
811 | - NULL, /* m_doc */ |
812 | - (Py_ssize_t) -1, /* m_size */ |
813 | - scss_methods, /* m_methods */ |
814 | - NULL, /* m_reload */ |
815 | - NULL, /* m_traverse */ |
816 | - NULL, /* m_clear */ |
817 | - NULL, /* m_free */ |
818 | -}; |
819 | - |
820 | -#endif |
821 | |
822 | /* Module init function */ |
823 | |
824 | -#if PY_MAJOR_VERSION >= 3 |
825 | - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) |
826 | -#else |
827 | - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) |
828 | -#endif |
829 | - |
830 | -MOD_INIT(_speedups) |
831 | +PyMODINIT_FUNC |
832 | +init_speedups(void) |
833 | { |
834 | -#if PY_MAJOR_VERSION >= 3 |
835 | - PyObject* m = PyModule_Create(&speedups_module_def); |
836 | -#else |
837 | - PyObject* m = Py_InitModule("_speedups", scss_methods); |
838 | -#endif |
839 | + PyObject* m; |
840 | |
841 | scss_BlockLocatorType.tp_new = PyType_GenericNew; |
842 | + if (PyType_Ready(&scss_BlockLocatorType) < 0) |
843 | + return; |
844 | + |
845 | scss_ScannerType.tp_new = PyType_GenericNew; |
846 | -#if PY_MAJOR_VERSION >= 3 |
847 | - if (PyType_Ready(&scss_BlockLocatorType) < 0 || PyType_Ready(&scss_ScannerType) < 0) |
848 | - return m; |
849 | -#else |
850 | - if (PyType_Ready(&scss_BlockLocatorType) < 0 || PyType_Ready(&scss_ScannerType) < 0) |
851 | + if (PyType_Ready(&scss_ScannerType) < 0) |
852 | return; |
853 | -#endif |
854 | |
855 | BlockLocator_initialize(); |
856 | Scanner_initialize(NULL, 0); |
857 | |
858 | + m = Py_InitModule("_speedups", scss_methods); |
859 | + |
860 | Py_INCREF(&scss_BlockLocatorType); |
861 | PyModule_AddObject(m, "_BlockLocator", (PyObject *)&scss_BlockLocatorType); |
862 | |
863 | @@ -615,8 +551,4 @@ |
864 | PyExc_scss_NoMoreTokens = PyErr_NewException("_speedups.NoMoreTokens", NULL, NULL); |
865 | Py_INCREF(PyExc_scss_NoMoreTokens); |
866 | PyModule_AddObject(m, "NoMoreTokens", (PyObject *)PyExc_scss_NoMoreTokens); |
867 | -#if PY_MAJOR_VERSION >= 3 |
868 | - |
869 | - return m; |
870 | -#endif |
871 | } |
872 | |
873 | === removed file 'scss/src/py3defs.h' |
874 | --- scss/src/py3defs.h 2014-09-17 11:11:52 +0000 |
875 | +++ scss/src/py3defs.h 1970-01-01 00:00:00 +0000 |
876 | @@ -1,29 +0,0 @@ |
877 | -/* |
878 | -* pyScss, a Scss compiler for Python |
879 | -* SCSS blocks scanner. |
880 | -* |
881 | -* German M. Bravo (Kronuz) <german.mb@gmail.com> |
882 | -* https://github.com/Kronuz/pyScss |
883 | -* |
884 | -* MIT license (http://www.opensource.org/licenses/mit-license.php) |
885 | -* Copyright (c) 2011 German M. Bravo (Kronuz), All rights reserved. |
886 | -*/ |
887 | -#ifndef PY3DEFS_H |
888 | -#define PY3DEFS_H |
889 | - |
890 | -/* Iterators are turned on by default in Python 3. */ |
891 | -#if PY_MAJOR_VERSION >= 3 |
892 | - #define Py_TPFLAGS_HAVE_ITER 0 |
893 | -#endif |
894 | - |
895 | -/* Py_TYPE exists in 2.6+, but for 2.5 and below we can use the old ob_type. */ |
896 | -#ifndef Py_TYPE |
897 | - #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) |
898 | -#endif |
899 | - |
900 | -/* PyVarObject_HEAD_INIT also exists in 2.6+, so for 2.5 use PyObject_HEAD_INIT. */ |
901 | -#ifndef PyVarObject_HEAD_INIT |
902 | - #define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, |
903 | -#endif |
904 | - |
905 | -#endif |