Co-authored-by: Cai Shanli <caishanli25@gmail.com>tags/20210322
| @@ -5,7 +5,7 @@ jobs: | |||||
| runs-on: windows-latest | runs-on: windows-latest | ||||
| strategy: | strategy: | ||||
| matrix: | matrix: | ||||
| python-version: [3.5, 3.6, 3.7, 3.8] | |||||
| python-version: [3.5, 3.6, 3.7, 3.8, 3.9] | |||||
| steps: | steps: | ||||
| - name: cancel-previous-runs | - name: cancel-previous-runs | ||||
| uses: styfle/cancel-workflow-action@0.7.0 | uses: styfle/cancel-workflow-action@0.7.0 | ||||
| @@ -21,7 +21,7 @@ jobs: | |||||
| - name: install dependencies | - name: install dependencies | ||||
| run: | | run: | | ||||
| python -m pip install --upgrade pip | python -m pip install --upgrade pip | ||||
| pip install pytest | |||||
| pip install pytest setuptools wheel twine | |||||
| - name: cache-protobuf | - name: cache-protobuf | ||||
| id: cache-protobuf | id: cache-protobuf | ||||
| uses: actions/cache@v1 | uses: actions/cache@v1 | ||||
| @@ -40,9 +40,18 @@ jobs: | |||||
| - name: build | - name: build | ||||
| run: | | run: | | ||||
| mkdir build; cd build | mkdir build; cd build | ||||
| cmake -DProtobuf_INCLUDE_DIR="$env:GITHUB_WORKSPACE\protobuf-install\include" -DProtobuf_LIBRARIES="$env:GITHUB_WORKSPACE\protobuf-install\lib\libprotobuf.lib" -DProtobuf_PROTOC_EXECUTABLE="$env:GITHUB_WORKSPACE\protobuf-install\bin\protoc.exe" -DNCNN_PYTHON=ON .. | |||||
| cmake -DProtobuf_INCLUDE_DIR="$env:GITHUB_WORKSPACE\protobuf-install\include" -DProtobuf_LIBRARIES="$env:GITHUB_WORKSPACE\protobuf-install\lib\libprotobuf.lib" -DProtobuf_PROTOC_EXECUTABLE="$env:GITHUB_WORKSPACE\protobuf-install\bin\protoc.exe" -DNCNN_PYTHON=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=OFF .. | |||||
| cmake --build . --config Release -j 2 | cmake --build . --config Release -j 2 | ||||
| - name: install python | - name: install python | ||||
| run: cd python && pip install . | run: cd python && pip install . | ||||
| - name: test | - name: test | ||||
| run: cd python && pytest tests | run: cd python && pytest tests | ||||
| - name: build and publish | |||||
| env: | |||||
| TWINE_USERNAME: __token__ | |||||
| TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} | |||||
| TWINE_REPOSITORY_URL: "https://test.pypi.org/legacy/" | |||||
| run: | | |||||
| cd python | |||||
| python setup.py bdist_wheel | |||||
| twine upload dist/* | |||||
| @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.4) | |||||
| project(pyncnn) | project(pyncnn) | ||||
| set(PACKAGE_VERSION "0.0.2") | |||||
| set(PACKAGE_VERSION ${NCNN_VERSION_STRING}) | |||||
| add_definitions(-DVERSION_INFO="${PACKAGE_VERSION}") | add_definitions(-DVERSION_INFO="${PACKAGE_VERSION}") | ||||
| set( CMAKE_CXX_STANDARD 11 ) | set( CMAKE_CXX_STANDARD 11 ) | ||||
| @@ -2,22 +2,43 @@ from setuptools import setup, find_packages | |||||
| import sys | import sys | ||||
| if sys.version_info < (3,0): | if sys.version_info < (3,0): | ||||
| sys.exit('Sorry, Python < 3.0 is not supported') | |||||
| sys.exit("Sorry, Python < 3.0 is not supported") | |||||
| try: | |||||
| from wheel.bdist_wheel import bdist_wheel as _bdist_wheel | |||||
| class bdist_wheel(_bdist_wheel): | |||||
| def finalize_options(self): | |||||
| _bdist_wheel.finalize_options(self) | |||||
| self.root_is_pure = False | |||||
| except ImportError: | |||||
| bdist_wheel = None | |||||
| requirements = [ | requirements = [ | ||||
| 'numpy', | |||||
| #'tqdm', | |||||
| #'requests', | |||||
| #'portalocker', | |||||
| #'opencv-python' | |||||
| "numpy", | |||||
| #"tqdm", | |||||
| #"requests", | |||||
| #"portalocker", | |||||
| #"opencv-python" | |||||
| ] | ] | ||||
| setup( | setup( | ||||
| name = 'ncnn', | |||||
| version = '${PACKAGE_VERSION}', | |||||
| url = 'https://github.com/Tencent/ncnn', | |||||
| packages = find_packages(), | |||||
| package_dir = {'': '.'}, | |||||
| package_data = {'ncnn': ['ncnn${PYTHON_MODULE_PREFIX}${PYTHON_MODULE_EXTENSION}']}, | |||||
| install_requires = requirements | |||||
| name = "ncnn", | |||||
| version = "${PACKAGE_VERSION}", | |||||
| author = "nihui", | |||||
| author_email = "nihuini@tencent.com", | |||||
| maintainer = "caishanli", | |||||
| maintainer_email = "caishanli25@gmail.com", | |||||
| description = "ncnn is a high-performance neural network inference framework optimized for the mobile platform", | |||||
| url = "https://github.com/Tencent/ncnn", | |||||
| classifiers = [ | |||||
| "Programming Language :: Python :: 3", | |||||
| "License :: OSI Approved :: BSD License", | |||||
| "Operating System :: OS Independent", | |||||
| ], | |||||
| python_requires = ">=3.5", | |||||
| packages = find_packages(), | |||||
| package_dir = {"": "."}, | |||||
| package_data = {"ncnn": ["ncnn${PYTHON_MODULE_PREFIX}${PYTHON_MODULE_EXTENSION}"]}, | |||||
| install_requires = requirements, | |||||
| cmdclass = {"bdist_wheel": bdist_wheel}, | |||||
| ) | ) | ||||