mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
replace setup.py with pyproject.toml + misc cleanup
This commit is contained in:
parent
04c86e8a89
commit
867d8ee49e
0
copyparty/res/__init__.py
Normal file
0
copyparty/res/__init__.py
Normal file
|
@ -228,6 +228,8 @@ pip install mutagen # audio metadata
|
||||||
pip install pyftpdlib # ftp server
|
pip install pyftpdlib # ftp server
|
||||||
pip install impacket # smb server -- disable Windows Defender if you REALLY need this on windows
|
pip install impacket # smb server -- disable Windows Defender if you REALLY need this on windows
|
||||||
pip install Pillow pyheif-pillow-opener pillow-avif-plugin # thumbnails
|
pip install Pillow pyheif-pillow-opener pillow-avif-plugin # thumbnails
|
||||||
|
pip install pyvips # faster thumbnails
|
||||||
|
pip install psutil # better cleanup of stuck metadata parsers on windows
|
||||||
pip install black==21.12b0 click==8.0.2 bandit pylint flake8 isort mypy # vscode tooling
|
pip install black==21.12b0 click==8.0.2 bandit pylint flake8 isort mypy # vscode tooling
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -264,19 +266,20 @@ uses the included prebuilt webdeps
|
||||||
if you downloaded a [release](https://github.com/9001/copyparty/releases) source tarball from github (for example [copyparty-1.6.15.tar.gz](https://github.com/9001/copyparty/releases/download/v1.6.15/copyparty-1.6.15.tar.gz) so not the autogenerated one) you can build it like so,
|
if you downloaded a [release](https://github.com/9001/copyparty/releases) source tarball from github (for example [copyparty-1.6.15.tar.gz](https://github.com/9001/copyparty/releases/download/v1.6.15/copyparty-1.6.15.tar.gz) so not the autogenerated one) you can build it like so,
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 setup.py install --user
|
python3 -m pip install --user -U build setuptools wheel jinja2 strip_hints
|
||||||
|
bash scripts/run-tests.sh python3 # optional
|
||||||
|
python3 -m build
|
||||||
```
|
```
|
||||||
|
|
||||||
or if you're packaging it for a linux distro (nice), maybe something like
|
if you are unable to use `build`, you can use the old setuptools approach instead,
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash scripts/run-tests.sh python3 # optional
|
python3 setup.py install --user setuptools wheel jinja2
|
||||||
python3 setup.py build
|
python3 setup.py build
|
||||||
|
# you now have a wheel which you can install. or extract and repackage:
|
||||||
python3 setup.py install --skip-build --prefix=/usr --root=$HOME/pe/copyparty
|
python3 setup.py install --skip-build --prefix=/usr --root=$HOME/pe/copyparty
|
||||||
```
|
```
|
||||||
|
|
||||||
if you have a very recent python where `setup.py install` finally got obliterated, see [the arch pkg](https://github.com/9001/copyparty/blob/hovudstraum/contrib/package/arch/PKGBUILD) for the current workaround until copyparty finally migrates to the toml meme
|
|
||||||
|
|
||||||
|
|
||||||
## complete release
|
## complete release
|
||||||
|
|
||||||
|
|
144
pyproject.toml
Normal file
144
pyproject.toml
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
[project]
|
||||||
|
name = "copyparty"
|
||||||
|
description = """
|
||||||
|
Portable file server with accelerated resumable uploads, \
|
||||||
|
deduplication, WebDAV, FTP, zeroconf, media indexer, \
|
||||||
|
video thumbnails, audio transcoding, and write-only folders"""
|
||||||
|
readme = "README.md"
|
||||||
|
authors = [{ name = "ed", email = "copyparty@ocv.me" }]
|
||||||
|
license = { text = "MIT" }
|
||||||
|
requires-python = ">=3.3"
|
||||||
|
dependencies = ["Jinja2"]
|
||||||
|
dynamic = ["version"]
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 5 - Production/Stable",
|
||||||
|
"License :: OSI Approved :: MIT License",
|
||||||
|
"Programming Language :: Python",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.3",
|
||||||
|
"Programming Language :: Python :: 3.4",
|
||||||
|
"Programming Language :: Python :: 3.5",
|
||||||
|
"Programming Language :: Python :: 3.6",
|
||||||
|
"Programming Language :: Python :: 3.7",
|
||||||
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
|
"Programming Language :: Python :: Implementation :: Jython",
|
||||||
|
"Programming Language :: Python :: Implementation :: PyPy",
|
||||||
|
"Environment :: Console",
|
||||||
|
"Environment :: No Input/Output (Daemon)",
|
||||||
|
"Intended Audience :: End Users/Desktop",
|
||||||
|
"Intended Audience :: System Administrators",
|
||||||
|
"Topic :: Communications :: File Sharing",
|
||||||
|
"Topic :: Internet :: File Transfer Protocol (FTP)",
|
||||||
|
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
"Source Code" = "https://github.com/9001/copyparty"
|
||||||
|
"Bug Tracker" = "https://github.com/9001/copyparty/issues"
|
||||||
|
"Demo Server" = "https://a.ocv.me/pub/demo/"
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
thumbnails = ["Pillow"]
|
||||||
|
thumbnails2 = ["pyvips"]
|
||||||
|
audiotags = ["mutagen"]
|
||||||
|
ftpd = ["pyftpdlib"]
|
||||||
|
ftps = ["pyftpdlib", "pyopenssl"]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
copyparty = "copyparty.__main__:main"
|
||||||
|
"up2k.py" = "copyparty.web.a.up2k:main"
|
||||||
|
"partyfuse.py" = "copyparty.web.a.partyfuse:main"
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
# requires = ["hatchling"]
|
||||||
|
# build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.version]
|
||||||
|
source = "code"
|
||||||
|
path = "copyparty/__version__.py"
|
||||||
|
|
||||||
|
[tool.setuptools.dynamic]
|
||||||
|
version = { attr = "copyparty.__version__.__version__" }
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["copyparty*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
copyparty = [
|
||||||
|
"res/COPYING.txt",
|
||||||
|
"res/insecure.pem",
|
||||||
|
"web/*.gz",
|
||||||
|
"web/*.html",
|
||||||
|
"web/a/*.bat",
|
||||||
|
"web/dd/*.png",
|
||||||
|
"web/deps/*.gz",
|
||||||
|
"web/deps/*.woff*",
|
||||||
|
]
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
[tool.black]
|
||||||
|
required-version = '21.12b0'
|
||||||
|
target-version = ['py27']
|
||||||
|
|
||||||
|
[tool.isort]
|
||||||
|
profile = "black"
|
||||||
|
include_trailing_comma = true
|
||||||
|
force_sort_within_sections = true
|
||||||
|
|
||||||
|
[tool.bandit]
|
||||||
|
skips = ["B104", "B110", "B112"]
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
[tool.pylint.MAIN]
|
||||||
|
py-version = "3.11"
|
||||||
|
jobs = 2
|
||||||
|
|
||||||
|
[tool.pylint."MESSAGES CONTROL"]
|
||||||
|
disable = [
|
||||||
|
"missing-module-docstring",
|
||||||
|
"missing-class-docstring",
|
||||||
|
"missing-function-docstring",
|
||||||
|
"import-outside-toplevel",
|
||||||
|
"wrong-import-position",
|
||||||
|
"raise-missing-from",
|
||||||
|
"bare-except",
|
||||||
|
"broad-exception-raised",
|
||||||
|
"broad-exception-caught",
|
||||||
|
"invalid-name",
|
||||||
|
"line-too-long",
|
||||||
|
"too-many-lines",
|
||||||
|
"consider-using-f-string",
|
||||||
|
"pointless-string-statement",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.pylint.FORMAT]
|
||||||
|
expected-line-ending-format = "LF"
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
[tool.mypy]
|
||||||
|
python_version = "3.11"
|
||||||
|
files = ["copyparty"]
|
||||||
|
show_error_codes = true
|
||||||
|
show_column_numbers = true
|
||||||
|
pretty = true
|
||||||
|
strict = true
|
||||||
|
local_partial_types = true
|
||||||
|
strict_equality = true
|
||||||
|
warn_unreachable = true
|
||||||
|
ignore_missing_imports = true
|
||||||
|
follow_imports = "silent"
|
||||||
|
|
||||||
|
[[tool.mypy.overrides]]
|
||||||
|
no_implicit_reexport = false
|
|
@ -73,14 +73,17 @@ pydir="$(
|
||||||
}
|
}
|
||||||
|
|
||||||
function have() {
|
function have() {
|
||||||
python -c "import $1; $1; $1.__version__"
|
python -c "import $1; $1; getattr($1,'__version__',0)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_env() {
|
function load_env() {
|
||||||
. buildenv/bin/activate
|
. buildenv/bin/activate
|
||||||
have setuptools
|
have setuptools
|
||||||
have wheel
|
have wheel
|
||||||
|
have build
|
||||||
have twine
|
have twine
|
||||||
|
have jinja2
|
||||||
|
have strip_hints
|
||||||
}
|
}
|
||||||
|
|
||||||
load_env || {
|
load_env || {
|
||||||
|
@ -88,19 +91,32 @@ load_env || {
|
||||||
deactivate || true
|
deactivate || true
|
||||||
rm -rf buildenv
|
rm -rf buildenv
|
||||||
python3 -m venv buildenv
|
python3 -m venv buildenv
|
||||||
(. buildenv/bin/activate && pip install twine wheel)
|
(. buildenv/bin/activate && pip install \
|
||||||
|
setuptools wheel build twine jinja2 strip_hints )
|
||||||
load_env
|
load_env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
rm -rf unt build/pypi
|
||||||
|
|
||||||
# grab licenses
|
# grab licenses
|
||||||
scripts/genlic.sh copyparty/res/COPYING.txt
|
scripts/genlic.sh copyparty/res/COPYING.txt
|
||||||
|
|
||||||
# remove type hints to support python < 3.9
|
# clean-ish packaging env
|
||||||
rm -rf build/pypi
|
rm -rf build/pypi
|
||||||
mkdir -p build/pypi
|
mkdir -p build/pypi
|
||||||
cp -pR setup.py README.md LICENSE copyparty contrib bin scripts/strip_hints build/pypi/
|
cp -pR pyproject.toml README.md LICENSE copyparty contrib bin scripts/strip_hints build/pypi/
|
||||||
tar -c docs/lics.txt scripts/genlic.sh build/*.txt | tar -xC build/pypi/
|
tar -c docs/lics.txt scripts/genlic.sh build/*.txt | tar -xC build/pypi/
|
||||||
cd build/pypi
|
cd build/pypi
|
||||||
|
|
||||||
|
# delete junk
|
||||||
|
find -name '*.pyc' -delete
|
||||||
|
find -name __pycache__ -delete
|
||||||
|
find -name py.typed -delete
|
||||||
|
find -type f \( -name .DS_Store -or -name ._.DS_Store \) -delete
|
||||||
|
find -type f -name ._\* | while IFS= read -r f; do cmp <(printf '\x00\x05\x16') <(head -c 3 -- "$f") && rm -f -- "$f"; done
|
||||||
|
|
||||||
|
# remove type hints to support python < 3.9
|
||||||
f=../strip-hints-0.1.10.tar.gz
|
f=../strip-hints-0.1.10.tar.gz
|
||||||
[ -e $f ] ||
|
[ -e $f ] ||
|
||||||
(url=https://files.pythonhosted.org/packages/9c/d4/312ddce71ee10f7e0ab762afc027e07a918f1c0e1be5b0069db5b0e7542d/strip-hints-0.1.10.tar.gz;
|
(url=https://files.pythonhosted.org/packages/9c/d4/312ddce71ee10f7e0ab762afc027e07a918f1c0e1be5b0069db5b0e7542d/strip-hints-0.1.10.tar.gz;
|
||||||
|
@ -136,20 +152,7 @@ rm -rf contrib
|
||||||
(cd copyparty/web && make -j$(nproc) && rm Makefile)
|
(cd copyparty/web && make -j$(nproc) && rm Makefile)
|
||||||
|
|
||||||
# build
|
# build
|
||||||
./setup.py clean2
|
python3 -m build
|
||||||
./setup.py sdist bdist_wheel --universal
|
|
||||||
|
|
||||||
[ "$mode" == t ] && twine upload -r pypitest dist/*
|
[ "$mode" == t ] && twine upload -r pypitest dist/*
|
||||||
[ "$mode" == u ] && twine upload -r pypi dist/*
|
[ "$mode" == u ] && twine upload -r pypi dist/*
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
|
|
||||||
|
|
||||||
all done!
|
|
||||||
|
|
||||||
to clean up the source tree:
|
|
||||||
|
|
||||||
cd ~/dev/copyparty
|
|
||||||
./setup.py clean2
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
5
setup.py
5
setup.py
|
@ -7,6 +7,11 @@ import sys
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from setuptools import setup, Command
|
from setuptools import setup, Command
|
||||||
|
|
||||||
|
_ = """
|
||||||
|
this probably still works but is no longer in use;
|
||||||
|
pyproject.toml and scripts/make-pypi-release.sh
|
||||||
|
are in charge of packaging wheels now
|
||||||
|
"""
|
||||||
|
|
||||||
NAME = "copyparty"
|
NAME = "copyparty"
|
||||||
VERSION = None
|
VERSION = None
|
||||||
|
|
Loading…
Reference in a new issue