Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
whtsky committed Apr 13, 2017
2 parents 1c66482 + dc41a2a commit 0e27053
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
os: osx
language: generic
osx_image: xcode6.4
env:
global:
- secure: "R5OivfMMAw1BhdwbBjEjfxhkqtj+Ntqf+jh+05Mr3y1aV8tC9J1vsq213Q7J7teweJ7WteHSj8ymJk2DdJ5mOIFEPAWQeuUIzcaplmfmsxYNdUhj19Ok8E8XG+ppBHccDaS3eE6GM6tDB9PouOE0MGA8/j9DLHXDSPTrjO/+G+AQ7V9M2+XqiEHJrPhlzas1h37XKLa5EzMIMK3atoUS1CLg6JOa+Rgz9OfXs+wQyErdQ5BjNfzZH4BKFhHl1zBViPv+j3SHDkyFw92mbXx14qn8xiyY3ZtKisMKT/X5o8DUJbWN3OdFF65NQq5lcnTFjIx06LJmy+zLjnZ83qggRuRPxAV2D9ODRBjDY3bdBMVSeaP/0yKldZyd14UXU3Ahwymi9lHC+MRgzRx5VyovptgOq3RfZ97peRT0NRDuotcxG1oFcAOIutH7oQZiAWZV7LLSSc3JdNCbwjRDm0MqzoD4TcMa8vCJMEZWSzLLygJYiZC0OklTnOYko5wdYms8aJw1FPjXbc2UNo6bVXXnbdoxEfadxtWKskNKF6tSdl766CMh/jM3gMv2bZkY2mYSnNp1RL1sslE33BZPgzW5fyFnUBskwQZEOidWx+uQ1eiPsnvb5FBC8on59fTVKkHh6Xiffqltq8Yvy33P12qoV+S9GHMT4DOm9bQf/qob2fQ="
Expand All @@ -8,6 +9,7 @@ env:
- VERSION=3.3
- VERSION=3.4
- VERSION=3.5
- VERSION=3.6
matrix:
include:
- sudo: required
Expand Down
13 changes: 11 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,32 @@ Usage

.. code-block:: python
from bencoder import bencode, bdecode
from bencoder import bencode, bdecode, bdecode2
assert bencode("WWWWWW") == b'6:WWWWWW'
assert bencode(233) == b'i233e'
with open("debian-8.3.0-amd64-netinst.iso.torrent", "rb") as f:
torrent = bdecode(f.read())
print(torrent['announce'])
decoded, length = bdecode2(b'6:WWWWWWi233e')
assert decoded == b'WWWWWW'
assert length == 8
ChangeLog
----------

Version 1.2.0
~~~~~~~~~~~~~~~

+ Add `bdecode2` method. `#6 <https://github.com/whtsky/bencoder.pyx/pull/6>`_

Version 1.1.3
~~~~~~~~~~~~~~~

+ Performance Improvement
+ Fix package metainfo ` #3 <https://github.com/whtsky/bencoder.pyx/issues/3>`_
+ Fix package metainfo `#3 <https://github.com/whtsky/bencoder.pyx/issues/3>`_

Version 1.1.2
~~~~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ environment:
- PYTHON: "C:\\Python34-x64"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"

init:
- ps: "ls C:/Python*"
Expand Down
2 changes: 1 addition & 1 deletion bencoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Based on https://github.com/karamanolev/bencode3/blob/master/bencode.py

__version__ = '1.1.3'
__version__ = '1.2.0'

import array

Expand Down
7 changes: 3 additions & 4 deletions ci/travis_osx_install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
git clone https://github.com/MacPython/terryfy.git
source terryfy/library_installers.sh
clean_builds
get_python_environment macpython $VERSION venv
git clone https://github.com/matthew-brett/multibuild.git
source multibuild/osx_utils.sh
get_macpython_environment $VERSION venv
pip install --upgrade pip wheel
pip install -r dev-requirements.txt
10 changes: 5 additions & 5 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytest
pytest-benchmark
coverage
cython
tox
pytest==3.0.5
pytest-benchmark==3.0.0
coverage==4.3.1
cython==0.25.2
tox==2.5.0
13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@
# Remove C file to force Cython recompile.
os.remove(c_path)
if 'test' in sys.argv and platform.python_implementation() == 'CPython':
from Cython.Compiler.Options import directive_defaults

directive_defaults['linetrace'] = True
directive_defaults['binding'] = True

from Cython.Build import cythonize
ext_modules = cythonize(Extension(
"bencoder",
[pyx_path],
define_macros=[('CYTHON_TRACE', '1')]
))
), compiler_directives={
'linetrace': True,
'binding': True
})
else:
from Cython.Build import cythonize
ext_modules = cythonize(Extension(
Expand Down Expand Up @@ -99,7 +97,7 @@ def get_tag(self):

setup(
name='bencoder.pyx',
version='1.1.3',
version='1.2.0',
description='Yet another bencode implementation in Cython',
long_description=open('README.rst', 'r').read(),
author='whtsky',
Expand All @@ -125,6 +123,7 @@ def get_tag(self):
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Intended Audience :: Developers',
Expand Down
8 changes: 7 additions & 1 deletion tests/test_decode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from bencoder import bdecode
from bencoder import bdecode, bdecode2
import os
import sys

Expand All @@ -10,6 +10,12 @@
)


def test_decode2():
decoded, length = bdecode2(b'6:WWWWWWi233e')
assert decoded == b'WWWWWW'
assert length == 8


def test_decode_str(benchmark):
assert benchmark(bdecode, b'6:WWWWWW') == b"WWWWWW"

Expand Down
2 changes: 1 addition & 1 deletion tox-wheels.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py26, py27, py33, py34, py35
envlist = py26, py27, py33, py34, py35, py36

[testenv]
commands = pip wheel {toxinidir} -w {toxinidir}/wheelhouse/
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py26, py27, py33, py34, py35, pypy
envlist = py26, py27, py33, py34, py35, py36, pypy

[testenv]
commands =
Expand Down

0 comments on commit 0e27053

Please sign in to comment.