Skip to content

Commit

Permalink
make build in separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
seiya-git committed Nov 20, 2023
1 parent 692b998 commit 623a5c1
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 35 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ jobs:
python-version: "3.x"
- name: Install pypa/build
run: |
cd py
python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
cd py
python3 -m build
cp -r ./py ./build
cp LICENSE.md ./build
cp README.md ./build
python3 -m build build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: py/dist/
path: build/dist/

publish-to-pypi:
name: >-
Expand All @@ -45,12 +46,12 @@ jobs:
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: py/dist/
path: build/dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TOKEN }}
packages-dir: py/dist
packages-dir: build/dist

github-release:
name: >-
Expand All @@ -69,13 +70,13 @@ jobs:
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: py/dist/
path: build/dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./py/dist/*.tar.gz
./py/dist/*.whl
./build/dist/*.tar.gz
./build/dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -92,7 +93,7 @@ jobs:
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' py/dist/**
'${{ github.ref_name }}' build/dist/**
--repo '${{ github.repository }}'
publish-to-testpypi:
Expand All @@ -113,10 +114,10 @@ jobs:
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: py/dist/
path: build/dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TOKEN_TEST }}
packages-dir: py/dist
packages-dir: build/dist
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
__pycache__
*.egg-info
dist
smartgit*

build/**
!build.bat
!build.sh
!setup.py

/logs
*_dev.py
*.xci
Expand Down
42 changes: 21 additions & 21 deletions LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License
Copyright (c) 2023
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License

Copyright (c) 2023

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 12 additions & 0 deletions build/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@echo off

set wdir=%cd%
cd /d %~dp0..

xcopy "py" "build" /I /E /Q /Y
xcopy "LICENSE.md" "build/LICENSE.md*" /Q /Y
xcopy "README.md" "build/README.md*" /Q /Y
python -m build build

cd /d %wdir%
pause
32 changes: 32 additions & 0 deletions build/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import setuptools

import os
from pathlib import Path

appPath = Path(os.path.abspath(__file__))
while not appPath.is_dir():
appPath = appPath.parents[0]

readmePath = Path(os.path.abspath(f'{appPath}/../README.md'))
long_description = ''

if readmePath.is_file():
with open(readmePath, 'r') as rmf:
long_description = rmf.read()

setuptools.setup(
name = 'nstools',
version = '1.1.5.dev2',
url = 'https://github.com/seiya-dev/NSTools',
long_description = long_description,
long_description_content_type = 'text/markdown',
packages=['nstools.Fs', 'nstools.nut', 'nstools.lib'],
install_requires=[
'zstandard',
'enlighten',
'pycryptodome',
],
python_requires = '>=3.10',
zip_safe = False,
include_package_data = True,
)

0 comments on commit 623a5c1

Please sign in to comment.