Skip to content

Commit 21306bb

Browse files
committed
fix: 修改 cython 问题
1 parent 1e93e54 commit 21306bb

File tree

10 files changed

+38
-33
lines changed

10 files changed

+38
-33
lines changed

MANIFEST.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
include LICENSE requirements.txt example.py README.md
2-
recursive-include site *.*
1+
include LICENSE requirements.txt README.md
2+
recursive-include demo *
33
recursive-include test *.*

Makefile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
PYTHON=`which python`
2+
3+
install:
4+
$(PYTHON) setup.py install
5+
6+
# 构建源码包
7+
build: wheel
8+
$(PYTHON) setup.py build sdist
9+
10+
build_ext:
11+
$(PYTHON) setup.py build_ext --inplace
12+
13+
# 构建 wheel 包
14+
wheel:
15+
$(PYTHON) setup.py bdist_wheel
16+
17+
upload-test:
18+
pip install twine; \
19+
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
20+
21+
upload:
22+
pip install twine; \
23+
twine upload dist/*
24+
25+
clean:
26+
rm -rf build dist *.egg-info __pycache__ tests/__pycache__ tests/*.pyc
27+
28+
.PHONY: test upload upload-test build wheel install clean
File renamed without changes.

demo/site/index.html.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def handler(self):
2+
self.start_response(200)
3+
return ['Hello World']
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

setup.py

100644100755
+5-21
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,9 @@
99
import posixpath
1010

1111
try:
12-
from setuptools import setup
12+
from setuptools import setup, Extension
1313
except ImportError:
14-
from distutils.core import setup
15-
try:
16-
from Cython.Build import cythonize
17-
except ImportError:
18-
os.system('pip install cython')
19-
from Cython.Build import cythonize
20-
21-
language_level = 2
22-
if sys.version_info[0] > 2:
23-
language_level = 3
14+
from distutils.core import setup, Extension
2415

2516
def get_str(var_name):
2617
src_py = open('litefs.py').read()
@@ -41,24 +32,17 @@ def get_long_str(var_name):
4132
author_email='[email protected]',
4233
url='https://github.com/leafcoder/litefs',
4334
py_modules=['litefs'],
44-
ext_modules=cythonize(
45-
'litefs.py',
46-
compiler_directives={
47-
'language_level': language_level
48-
}
49-
),
5035
license=get_str('__license__'),
5136
platforms='any',
5237
package_data={
53-
'': ['*.txt', '*.md', 'LICENSE', 'example.py', 'MANIFEST.in'],
54-
'site': ['site/*', '*.py'],
38+
'': ['*.txt', '*.md', 'LICENSE', 'MANIFEST.in'],
39+
'demo': ['demo/*', '*.py'],
5540
'test': ['test/*', '*.py']
5641
},
5742
install_requires=open('requirements.txt').read().split('\n'),
58-
setup_requires=['cython', 'tox'],
5943
entry_points={
6044
'console_scripts': [
61-
'litefs=litefs.entry:test_server',
45+
'litefs=litefs:test_server',
6246
]
6347
},
6448
classifiers=[

site/index.html

-10
This file was deleted.

0 commit comments

Comments
 (0)