Skip to content

Commit 82bd006

Browse files
committed
packaging
1 parent b7e7185 commit 82bd006

File tree

10 files changed

+178
-141
lines changed

10 files changed

+178
-141
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
.eggs/
1010
dist/
1111
build/
12+
buildenv/
1213
html/
1314
.tox/
1415
*.swp

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 23 deletions
This file was deleted.

partftpy/bin/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.

pyproject.toml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,60 @@
1+
[project]
2+
name = "partftpy"
3+
description = "tftpd module for copyparty"
4+
readme = "README.md"
5+
authors = [{ name = "ed", email = "[email protected]" }]
6+
license = { text = "MIT" }
7+
requires-python = ">=2.7"
8+
dependencies = []
9+
dynamic = ["version"]
10+
classifiers = [
11+
"Development Status :: 4 - Beta",
12+
"License :: OSI Approved :: MIT License",
13+
"Programming Language :: Python",
14+
"Programming Language :: Python :: 2",
15+
"Programming Language :: Python :: 2.7",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.3",
18+
"Programming Language :: Python :: 3.4",
19+
"Programming Language :: Python :: 3.5",
20+
"Programming Language :: Python :: 3.6",
21+
"Programming Language :: Python :: 3.7",
22+
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: Implementation :: CPython",
28+
"Programming Language :: Python :: Implementation :: PyPy",
29+
"Operating System :: OS Independent",
30+
"Environment :: Console",
31+
"Environment :: No Input/Output (Daemon)",
32+
"Intended Audience :: Developers",
33+
"Intended Audience :: System Administrators",
34+
"Topic :: Internet",
35+
]
36+
37+
[project.urls]
38+
"Source Code" = "http://github.com/9001/partftpy"
39+
"Bug Tracker" = "http://github.com/9001/partftpy/issues"
40+
41+
[project.scripts]
42+
"partftpy_client" = "partftpy.bin.partftpy_client:main"
43+
"partftpy_server" = "partftpy.bin.partftpy_server:main"
44+
45+
# =====================================================================
46+
47+
[tool.hatch.version]
48+
source = "code"
49+
path = "partftpy/__init__.py"
50+
51+
[tool.setuptools.dynamic]
52+
version = { attr = "partftpy.__init__.__version__" }
53+
54+
# =====================================================================
55+
156
[build-system]
2-
requires = ["setuptools", "wheel", "setuptools_scm[toml]"]
57+
requires = ["setuptools", "wheel"]
358
build-backend = "setuptools.build_meta"
459

560
[tool.pytest.ini_options]

scripts/make-pypi-release.sh

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/bin/bash
2+
set -e
3+
echo
4+
5+
# osx support
6+
# port install gnutar findutils gsed coreutils
7+
gtar=$(command -v gtar || command -v gnutar) || true
8+
[ ! -z "$gtar" ] && command -v gfind >/dev/null && {
9+
tar() { $gtar "$@"; }
10+
sed() { gsed "$@"; }
11+
find() { gfind "$@"; }
12+
sort() { gsort "$@"; }
13+
command -v grealpath >/dev/null &&
14+
realpath() { grealpath "$@"; }
15+
}
16+
17+
mode="$1"
18+
19+
[ -z "$mode" ] &&
20+
{
21+
echo "need argument 1: (D)ry, (T)est, (U)pload"
22+
echo " optional arg 2: fast"
23+
echo
24+
exit 1
25+
}
26+
27+
[ -e partftpy/TftpServer.py ] || cd ..
28+
[ -e partftpy/TftpServer.py ] ||
29+
{
30+
echo "run me from within the partftpy folder"
31+
echo
32+
exit 1
33+
}
34+
35+
36+
# one-time stuff, do this manually through copy/paste
37+
true ||
38+
{
39+
cat > ~/.pypirc <<EOF
40+
[distutils]
41+
index-servers =
42+
pypi
43+
pypitest
44+
45+
[pypi]
46+
repository: https://upload.pypi.org/legacy/
47+
username: qwer
48+
password: asdf
49+
50+
[pypitest]
51+
repository: https://test.pypi.org/legacy/
52+
username: qwer
53+
password: asdf
54+
EOF
55+
56+
# set pypi password
57+
chmod 600 ~/.pypirc
58+
sed -ri 's/qwer/username/;s/asdf/password/' ~/.pypirc
59+
}
60+
61+
62+
63+
pydir="$(
64+
which python |
65+
sed -r 's@[^/]*$@@'
66+
)"
67+
68+
[ -e "$pydir/activate" ] &&
69+
{
70+
echo '`deactivate` your virtualenv'
71+
exit 1
72+
}
73+
74+
function have() {
75+
python -c "import $1; $1; getattr($1,'__version__',0)"
76+
}
77+
78+
function load_env() {
79+
. buildenv/bin/activate || return 1
80+
have setuptools &&
81+
have wheel &&
82+
have build &&
83+
have twine &&
84+
have jinja2 &&
85+
have strip_hints &&
86+
return 0 || return 1
87+
}
88+
89+
load_env || {
90+
echo creating buildenv
91+
deactivate || true
92+
rm -rf buildenv
93+
python3 -m venv buildenv
94+
(. buildenv/bin/activate && pip install \
95+
setuptools wheel build twine jinja2 strip_hints )
96+
load_env
97+
}
98+
99+
# cleanup
100+
rm -rf build/pypi
101+
102+
# clean-ish packaging env
103+
rm -rf build/pypi
104+
mkdir -p build/pypi
105+
cp -pR pyproject.toml README.md LICENSE partftpy build/pypi/
106+
cd build/pypi
107+
108+
# delete junk
109+
find -name '*.pyc' -delete
110+
find -name __pycache__ -delete
111+
find -name py.typed -delete
112+
find -type f \( -name .DS_Store -or -name ._.DS_Store \) -delete
113+
find -type f -name ._\* | while IFS= read -r f; do cmp <(printf '\x00\x05\x16') <(head -c 3 -- "$f") && rm -f -- "$f"; done
114+
115+
# build
116+
python3 -m build
117+
118+
[ "$mode" == t ] && twine upload -r pypitest dist/*
119+
[ "$mode" == u ] && twine upload -r pypi dist/*
120+
121+
true

setup.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

tox.ini

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)