diff --git a/MANIFEST.in b/MANIFEST.in index 3fe8f2d..537f7f2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ -include LICENSE requirements.txt example.py README.md -recursive-include site *.* +include LICENSE requirements.txt README.md +recursive-include demo * recursive-include test *.* \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2ac34cd --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +PYTHON=`which python` + +install: + $(PYTHON) setup.py install + +# 构建源码包 +build: wheel + $(PYTHON) setup.py build sdist + +build_ext: + $(PYTHON) setup.py build_ext --inplace + +# 构建 wheel 包 +wheel: + $(PYTHON) setup.py bdist_wheel + +upload-test: + pip install twine; \ + twine upload --repository-url https://test.pypi.org/legacy/ dist/* + +upload: + pip install twine; \ + twine upload dist/* + +clean: + rm -rf build dist *.egg-info __pycache__ tests/__pycache__ tests/*.pyc + +.PHONY: test upload upload-test build wheel install clean diff --git a/README.md b/README.md index 9539715..8c373c3 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ GitHub top language GitHub code size in bytes GitHub commit activity - GitHub All Releases + PyPI - Downloads

@@ -31,4 +31,4 @@ Build a web server framework using Python. Litefs was developed to implement a server framework that can quickly, securely, and flexibly build Web projects. Litefs is a high-performance HTTP server. Litefs has the characteristics of high stability, rich functions, and low system -consumption. \ No newline at end of file +consumption. diff --git a/example.py b/demo/example.py similarity index 100% rename from example.py rename to demo/example.py diff --git a/demo/site/index.html.py b/demo/site/index.html.py new file mode 100644 index 0000000..9a23965 --- /dev/null +++ b/demo/site/index.html.py @@ -0,0 +1,3 @@ +def handler(self): + self.start_response(200) + return ['Hello World'] \ No newline at end of file diff --git a/site/not_found b/demo/site/not_found similarity index 100% rename from site/not_found rename to demo/site/not_found diff --git a/site/test.py b/demo/site/test.py similarity index 100% rename from site/test.py rename to demo/site/test.py diff --git a/site/test_iter.py b/demo/site/test_iter.py similarity index 100% rename from site/test_iter.py rename to demo/site/test_iter.py diff --git a/site/test_mako.mako b/demo/site/test_mako.mako similarity index 100% rename from site/test_mako.mako rename to demo/site/test_mako.mako diff --git a/requirements.txt b/requirements.txt index 8e17529..f40f34d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,7 @@ argh==0.26.2 -Cython==0.29.14 greenlet==0.4.13 -Mako==1.0.6 +Mako==1.2.2 MarkupSafe==1.1.1 pathtools==0.1.2 -PyYAML==5.1 +PyYAML==5.4 watchdog==0.8.3 diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index aa6f51b..7e29354 --- a/setup.py +++ b/setup.py @@ -9,18 +9,9 @@ import posixpath try: - from setuptools import setup + from setuptools import setup, Extension except ImportError: - from distutils.core import setup -try: - from Cython.Build import cythonize -except ImportError: - os.system('pip install cython') - from Cython.Build import cythonize - -language_level = 2 -if sys.version_info[0] > 2: - language_level = 3 + from distutils.core import setup, Extension def get_str(var_name): src_py = open('litefs.py').read() @@ -41,24 +32,17 @@ def get_long_str(var_name): author_email='leafcoder@gmail.com', url='https://github.com/leafcoder/litefs', py_modules=['litefs'], - ext_modules=cythonize( - 'litefs.py', - compiler_directives={ - 'language_level': language_level - } - ), license=get_str('__license__'), platforms='any', package_data={ - '': ['*.txt', '*.md', 'LICENSE', 'example.py', 'MANIFEST.in'], - 'site': ['site/*', '*.py'], + '': ['*.txt', '*.md', 'LICENSE', 'MANIFEST.in'], + 'demo': ['demo/*', '*.py'], 'test': ['test/*', '*.py'] }, install_requires=open('requirements.txt').read().split('\n'), - setup_requires=['cython', 'tox'], entry_points={ 'console_scripts': [ - 'litefs=litefs.entry:test_server', + 'litefs=litefs:test_server', ] }, classifiers=[ diff --git a/site/index.html b/site/index.html deleted file mode 100644 index 2d6c89b..0000000 --- a/site/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Untitle - - - Hello world. - -