Permalink
Browse files

Version bump introducing speedups

  • Loading branch information...
1 parent a9d98b6 commit b388a606bae87bc1a09f1739f98e3be2f0ac1406 @Kronuz committed Jan 3, 2012
View
@@ -1,8 +1,8 @@
Changelog
=========
-1.1.1 - ???
+1.1.1 Jan 2, 2012
+ Added optional C module for an amazing boost in scanning speed!
- + Added ``headings``, ``stylesheet-url``, ``font-url``, ``font-files`` and ``inline-font-files``.
+ + Added ``headings``, ``stylesheet-url``, ``font-url``, ``font-files``, ``inline-font-files`` and ``sprite-names``.
1.1.0 - Dec 22, 2011
+ Added min() and max() for lists.
View
@@ -1,14 +0,0 @@
-./DESCRIPTION
-./grammar/grammar.g
-./grammar/LICENSE
-./grammar/yapps2.py
-./grammar/yappsrt.py
-./LICENSE
-./MANIFEST
-./README.rst
-./scss.py
-./setup.py
-./pyScss.egg-info/PKG-INFO
-./pyScss.egg-info/SOURCES.txt
-./pyScss.egg-info/dependency_links.txt
-./pyScss.egg-info/top_level.txt
View
@@ -0,0 +1,2 @@
+include DESCRIPTION LICENSE CHANGELOG README.rst
+recursive-include scss *
View
@@ -1,12 +1,12 @@
Metadata-Version: 1.0
Name: pyScss
-Version: 1.1.0
+Version: 1.1.1
Summary: pyScss, a Scss compiler for Python
Home-page: http://github.com/Kronuz/pyScss
Author: German M. Bravo (Kronuz)
Author-email: german.mb@gmail.com
License: MIT
-Download-URL: http://github.com/Kronuz/pyScss/tarball/v1.1.0
+Download-URL: http://github.com/Kronuz/pyScss/tarball/v1.1.1
Description: pyScss, a Scss compiler for Python
==================================
:Author:
@@ -1,13 +1,35 @@
+CHANGELOG
DESCRIPTION
LICENSE
-MANIFEST
+MANIFEST.in
README.rst
setup.py
pyScss.egg-info/PKG-INFO
pyScss.egg-info/SOURCES.txt
pyScss.egg-info/dependency_links.txt
pyScss.egg-info/entry_points.txt
pyScss.egg-info/top_level.txt
+scss/.DS_Store
scss/__init__.py
+scss/__init__.pyc
scss/scss_meta.py
-scss/src/_scss.c
+scss/scss_meta.pyc
+scss/setup.py
+scss/tests.rst
+scss/src/.DS_Store
+scss/src/_scss.c
+scss/src/block_locator.c
+scss/src/block_locator.h
+scss/src/block_locator.py
+scss/src/build.py
+scss/src/scanner.c
+scss/src/scanner.h
+scss/src/scanner.py
+scss/src/utils.h
+scss/src/grammar/LICENSE
+scss/src/grammar/README
+scss/src/grammar/grammar.g
+scss/src/grammar/grammar.py
+scss/src/grammar/yapps2.py
+scss/src/grammar/yappsrt.py
+scss/src/grammar/yappsrt.pyc
@@ -1,4 +1,4 @@
- [console_scripts]
- pyscss = scss:main
-
+ [console_scripts]
+ pyscss = scss:main
+
View
@@ -4,9 +4,9 @@
pyScss, a Scss compiler for Python
@author German M. Bravo (Kronuz) <german.mb@gmail.com>
-@version 1.0
+@version 1.1.1
@see https://github.com/Kronuz/pyScss
-@copyright (c) 2011 German M. Bravo (Kronuz)
+@copyright (c) 2012 German M. Bravo (Kronuz)
@license MIT License
http://www.opensource.org/licenses/mit-license.php
@@ -80,9 +80,9 @@
locate_blocks = None
Scanner = None
try:
- from _scss import locate_blocks, Scanner, NoMoreTokens
+ from _speedups import locate_blocks, Scanner, NoMoreTokens
except ImportError:
- print >>sys.stderr, "Scanning acceleration disabled (_scss not found)!"
+ print >>sys.stderr, "Scanning acceleration disabled (_speedups not found)!"
pass
################################################################################
@@ -4396,6 +4396,7 @@ def __radd__(self, other):
'image-color:2': _image_color,
'image-color:3': _image_color,
'sprite-map:1': _sprite_map,
+ 'sprite-names:1': _sprites,
'sprites:1': _sprites,
'sprite:2': _sprite,
'sprite:3': _sprite,
@@ -4851,14 +4852,14 @@ class CalculatorScanner(CachedScanner):
('ID', '[-a-zA-Z_][-a-zA-Z0-9_]*'),
]
- def __init__(self):
+ def __init__(self, input=None):
if hasattr(self, 'setup_patterns'):
self.setup_patterns(self._patterns)
elif self.patterns is None:
self.__class__.patterns = []
for t, p in self._patterns:
self.patterns.append((t, re.compile(p)))
- Scanner.__init__(self, None, ['[ \r\t\n]+'])
+ super(CalculatorScanner, self).__init__(None, ['[ \r\t\n]+'], input)
class Calculator(Parser):
View
@@ -1,144 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import sys
-from ctypes import *
-from os.path import join, dirname
-
-if sys.platform == 'win32':
- ext = 'dll'
-else:
- ext = 'so'
-
-_scss = cdll.LoadLibrary(join(dirname(__file__), '_scss_c.%s' % ext))
-
-
-########################################
-# the Block struct
-########################################
-
-class Block(Structure):
- _fields_ = [
- ('_error', c_int),
- ('_lineno', c_int),
- ('_selprop', POINTER(c_char)),
- ('_selprop_sz', c_int),
- ('_codestr', POINTER(c_char)),
- ('_codestr_sz', c_int),
- ]
-
- def lineno_get(self):
- return self._lineno
-
- def lineno_set(self, value):
- raise AttributeError('lineno attribute is read only')
- lineno = property(lineno_get, lineno_set)
-
- def selprop_get(self):
- try:
- if self._selprop_sz:
- return string_at(self._selprop, self._selprop_sz)
- return ''
- except:
- raise
-
- def selprop_set(self, value):
- raise AttributeError('selprop attribute is read only')
- selprop = property(selprop_get, selprop_set)
-
- def codestr_get(self):
- try:
- if self._codestr_sz:
- return string_at(self._codestr, self._codestr_sz)
- return ''
- except:
- raise
-
- def codestr_set(self, value):
- raise AttributeError('codestr attribute is read only')
- codestr = property(codestr_get, codestr_set)
-
- def __nonzero__(self):
- return self._error != 0
-
- def __repr__(self):
- return '<Block %d %s>' % (self.lineno, self.selprop.__repr__())
-
- def __unicode__(self):
- return self.selprop
-
-
-########################################
-# Init function prototypes
-########################################
-
-_scss.block_locator_create.argtypes = [c_char_p, c_int]
-_scss.block_locator_create.restype = c_void_p
-
-_scss.block_locator_rewind.argtypes = [c_void_p]
-_scss.block_locator_rewind.restype = None
-
-_scss.block_locator_destroy.argtypes = [c_void_p]
-_scss.block_locator_destroy.restype = None
-
-_scss.block_locator_next_block.argtypes = [c_void_p]
-_scss.block_locator_next_block.restype = POINTER(Block)
-
-
-########################################
-# Python API
-########################################
-
-class BlockLocator(object):
- def __init__(self, codestr):
- """
- Create a BlockLocator instance to segment codestr.
- """
- self._unicode = False
- self._destroyed = False
- if isinstance(codestr, unicode):
- codestr = codestr.encode('utf8')
- self._unicode = True
- self._locator = _scss.block_locator_create(codestr, len(codestr))
-
- def __iter__(self):
- """
- Iterate through all blocks. Note the iteration has
- side-effect: an BlockLocator object can only be iterated
- once.
- """
- while True:
- block = self.next_block()
- if block is None:
- raise StopIteration
- if self._unicode:
- yield block.lineno, block.selprop.decode('utf8'), block.codestr.decode('utf8')
- else:
- yield block.lineno, block.selprop, block.codestr
-
- def next_block(self):
- """
- Get next block. When no block is available, return None.
- """
- if self._destroyed:
- return None
-
- block = _scss.block_locator_next_block(self._locator)
- block = block.contents
- if block._error >= 0:
- _scss.block_locator_rewind(self._locator)
- if block._error > 0:
- raise Exception({
- 1: "Missing closing parenthesis somewhere in block",
- 2: "Missing closing string somewhere in block",
- 3: "Block never closed",
- }.get(block._error), block._error)
- return None
- else:
- return block
-
- def __del__(self):
- if not self._destroyed:
- _scss.block_locator_destroy(self._locator)
- self._destroyed = True
-
-locate_blocks = BlockLocator
Oops, something went wrong.

0 comments on commit b388a60

Please sign in to comment.