Skip to content

Commit

Permalink
Merge branch 'release/v2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Dec 28, 2016
2 parents 735da3f + 291eeba commit 173f096
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 5 deletions.
26 changes: 26 additions & 0 deletions LICENSE
@@ -0,0 +1,26 @@
Copyright (c) 2016, Rick van Hattem <wolph@wol.ph> All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -2,6 +2,7 @@
include-recursive *.rst
include stl/*.pyx
include stl/*.c
include LICENSE

# Include docs and tests
graft tests
Expand Down
4 changes: 2 additions & 2 deletions build.cmd
Expand Up @@ -4,7 +4,7 @@
:: MS Windows SDK for Windows 7 and .NET Framework 4
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
:: https://github.com/cython/cython/wiki/CythonExtensionsOnWindows

IF "%DISTUTILS_USE_SDK%"=="1" (
ECHO Configuring environment to build with MSVC on a 64bit architecture
Expand All @@ -18,4 +18,4 @@ IF "%DISTUTILS_USE_SDK%"=="1" (
ECHO Using default MSVC build environment
)

CALL %*
CALL %*
2 changes: 1 addition & 1 deletion stl/__about__.py
@@ -1,6 +1,6 @@
__package_name__ = 'numpy-stl'
__import_name__ = 'stl'
__version__ = '2.0.0'
__version__ = '2.1.0'
__author__ = 'Rick van Hattem'
__author_email__ = 'Wolph@Wol.ph'
__description__ = '''
Expand Down
22 changes: 22 additions & 0 deletions stl/base.py
Expand Up @@ -3,6 +3,7 @@
import enum
import math
import numpy
import logging
import collections

from python_utils import logger
Expand All @@ -25,6 +26,7 @@ class Dimension(enum.IntEnum):
#: Z index (for example, `mesh.v0[0][Z]`)
Z = 2


# For backwards compatibility, leave the original references
X = Dimension.X
Y = Dimension.Y
Expand Down Expand Up @@ -52,6 +54,26 @@ def map(cls, value):
return value


def logged(class_):
# For some reason the Logged baseclass is not properly initiated on Linux
# systems while this works on OS X. Please let me know if you can tell me
# what silly mistake I made here

logger_name = logger.Logged._Logged__get_name(
__name__,
class_.__name__,
)

class_.logger = logging.getLogger(logger_name)

for key in dir(logger.Logged):
if not key.startswith('__'):
setattr(class_, key, getattr(class_, key))

return class_


@logged
class BaseMesh(logger.Logged, collections.Mapping):
'''
Mesh object with easy access to the vectors through v0, v1 and v2.
Expand Down
4 changes: 3 additions & 1 deletion stl/stl.py
Expand Up @@ -28,11 +28,13 @@ class Mode(enum.IntEnum):
#: Force writing BINARY
BINARY = 2


# For backwards compatibility, leave the original references
AUTOMATIC = Mode.AUTOMATIC
ASCII = Mode.ASCII
BINARY = Mode.BINARY


#: Amount of bytes to read while using buffered reading
BUFFER_SIZE = 4096
#: The amount of bytes in the header field
Expand Down Expand Up @@ -284,7 +286,7 @@ def _write_binary(self, fh, name):

# Make it exactly 80 characters
header = header[:80].ljust(80, ' ')
packed = struct.pack('@i', self.data.size)
packed = struct.pack(s('@i'), self.data.size)

if isinstance(fh, io.TextIOWrapper): # pragma: no cover
packed = str(packed)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -20,7 +20,7 @@ basepython =

[testenv:flake8]
basepython=python
commands = flake8 --ignore=W391 src tests
commands = flake8 --ignore=W391 stl tests

[testenv:docs]
basepython=python
Expand Down

0 comments on commit 173f096

Please sign in to comment.