Skip to content

Commit 11b4ae6

Browse files
committed
sync wity pyexcel commons
1 parent 5633791 commit 11b4ae6

File tree

6 files changed

+52
-19
lines changed

6 files changed

+52
-19
lines changed

.moban.d/setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{% extends 'setup.py.jj2' %}
22

3+
{%block platform_block%}
4+
{%endblock%}
5+
36
{%block additional_keywords%}
47
"plain",
58
"simple",

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ before_install:
3737
pip install git+https://bitbucket.org/astanin/python-tabulate ;
3838
echo > README.rst ;
3939
fi
40+
- if [[ $TRAVIS_PYTHON_VERSION == "2.6" ]]; then pip install flake8==2.6.2; fi
4041
- if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then
4142
mv min_requirements.txt requirements.txt ;
4243
fi
43-
- pip install --upgrade "setuptools" "pip==7.1"
44+
- pip install --upgrade setuptools "pip==7.1"
4445
- test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt
4546
- test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ;
4647
- pip install -r tests/requirements.txt

min_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pyexcel==0.3.0
1+
pyexcel==0.2.2
22
tabulate==0.7.4

setup.py

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
from ez_setup import use_setuptools
55
use_setuptools()
66
from setuptools import setup, find_packages
7+
import sys
8+
PY2 = sys.version_info[0] == 2
9+
PY26 = PY2 and sys.version_info[1] < 7
710

811
NAME = 'pyexcel-text'
912
AUTHOR = 'C.W.'
1013
VERSION = '0.2.4'
1114
EMAIL = 'wangc_2011 (at) hotmail.com'
1215
LICENSE = 'New BSD'
13-
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests'])
1416
DESCRIPTION = (
1517
'A plugin to pyexcel and provides the capability to present and write d' +
1618
'ata in text formats' +
@@ -33,14 +35,6 @@
3335
"json"
3436
]
3537

36-
INSTALL_REQUIRES = [
37-
'pyexcel>=0.2.2',
38-
'tabulate>=0.7.4',
39-
]
40-
41-
EXTRAS_REQUIRE = {
42-
}
43-
4438
CLASSIFIERS = [
4539
'Topic :: Office/Business',
4640
'Topic :: Utilities',
@@ -55,19 +49,52 @@
5549
'Programming Language :: Python :: Implementation :: PyPy'
5650
]
5751

52+
INSTALL_REQUIRES = [
53+
'pyexcel>=0.2.2',
54+
'tabulate>=0.7.4',
55+
]
56+
57+
58+
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests'])
59+
EXTRAS_REQUIRE = {
60+
}
61+
5862

5963
def read_files(*files):
6064
"""Read files into setup"""
6165
text = ""
6266
for single_file in files:
63-
text = text + read(single_file) + "\n"
67+
content = read(single_file)
68+
text = text + content + "\n"
6469
return text
6570

6671

6772
def read(afile):
6873
"""Read a file into setup"""
6974
with open(afile, 'r') as opened_file:
70-
return opened_file.read()
75+
content = filter_out_test_code(opened_file)
76+
content = "".join(list(content))
77+
return content
78+
79+
80+
def filter_out_test_code(file_handle):
81+
found_test_code = False
82+
for line in file_handle.readlines():
83+
if line.startswith('.. testcode:'):
84+
found_test_code = True
85+
continue
86+
if found_test_code is True:
87+
if line.startswith(' '):
88+
continue
89+
else:
90+
empty_line = line.strip()
91+
if len(empty_line) == 0:
92+
continue
93+
else:
94+
found_test_code = False
95+
yield line
96+
else:
97+
yield line
7198

7299

73100
if __name__ == '__main__':
@@ -77,14 +104,14 @@ def read(afile):
77104
version=VERSION,
78105
author_email=EMAIL,
79106
description=DESCRIPTION,
80-
install_requires=INSTALL_REQUIRES,
107+
long_description=read_files('README.rst', 'CHANGELOG.rst'),
108+
license=LICENSE,
81109
keywords=KEYWORDS,
82110
extras_require=EXTRAS_REQUIRE,
111+
tests_require=['nose'],
112+
install_requires=INSTALL_REQUIRES,
83113
packages=PACKAGES,
84114
include_package_data=True,
85-
long_description=read_files('README.rst', 'CHANGELOG.rst'),
86115
zip_safe=False,
87-
tests_require=['nose'],
88-
license=LICENSE,
89116
classifiers=CLASSIFIERS
90117
)

test.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11

2+
23
pip freeze
3-
nosetests --with-cov --cover-package pyexcel_text --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_text && flake8 . --exclude=.moban.d
4+
nosetests --with-cov --cover-package pyexcel_text --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_text && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long

test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11

2+
23
pip freeze
3-
nosetests --with-cov --cover-package pyexcel_text --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_text && flake8 . --exclude=.moban.d
4+
nosetests --with-cov --cover-package pyexcel_text --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_text && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long

0 commit comments

Comments
 (0)