fix testrunner + packaging

This commit is contained in:
ed 2022-12-03 15:07:47 +00:00
parent 89ba12065c
commit 8ef4a0aa71
10 changed files with 61 additions and 29 deletions

View file

View file

View file

View file

@ -1,5 +0,0 @@
cd %~dp0\..
python setup.py clean2
python setup.py rstconv
python setup.py sdist bdist_wheel --universal
REM python setup.py sdist upload -r pypi

View file

@ -55,14 +55,6 @@ EOF
# set pypi password # set pypi password
chmod 600 ~/.pypirc chmod 600 ~/.pypirc
sed -ri 's/qwer/username/;s/asdf/password/' ~/.pypirc sed -ri 's/qwer/username/;s/asdf/password/' ~/.pypirc
# if PY2: create build env
cd ~/dev/copyparty && virtualenv buildenv
(. buildenv/bin/activate && pip install twine)
# if PY3: create build env
cd ~/dev/copyparty && python3 -m venv buildenv
(. buildenv/bin/activate && pip install twine wheel)
} }
@ -82,15 +74,27 @@ function have() {
python -c "import $1; $1; $1.__version__" python -c "import $1; $1; $1.__version__"
} }
function load_env() {
. buildenv/bin/activate . buildenv/bin/activate
have setuptools have setuptools
have wheel have wheel
have twine have twine
}
load_env || {
echo creating buildenv
deactivate || true
rm -rf buildenv
python3 -m venv buildenv
(. buildenv/bin/activate && pip install twine wheel)
load_env
}
# remove type hints to support python < 3.9 # remove type hints to support python < 3.9
rm -rf build/pypi rm -rf build/pypi
mkdir -p build/pypi mkdir -p build/pypi
cp -pR setup.py README.md LICENSE copyparty tests bin scripts/strip_hints build/pypi/ cp -pR setup.py README.md LICENSE copyparty tests bin scripts/strip_hints build/pypi/
tar -c docs/lics.txt scripts/genlic.sh build/*.txt | tar -xC build/pypi/
cd build/pypi cd build/pypi
f=../strip-hints-0.1.10.tar.gz f=../strip-hints-0.1.10.tar.gz
[ -e $f ] || [ -e $f ] ||

View file

@ -5,6 +5,24 @@ rm -rf unt
mkdir -p unt/srv mkdir -p unt/srv
cp -pR copyparty tests unt/ cp -pR copyparty tests unt/
cd unt cd unt
# resolve symlinks
set +x
find -type l |
while IFS= read -r f1; do (
cd "${f1%/*}"
f1="./${f1##*/}"
f2="$(readlink "$f1")"
[ -e "$f2" ] || f2="../$f2"
[ -e "$f2" ] || {
echo could not resolve "$f1"
exit 1
}
rm "$f1"
cp -p "$f2" "$f1"
); done
set -x
python3 ../scripts/strip_hints/a.py python3 ../scripts/strip_hints/a.py
pids=() pids=()
@ -12,7 +30,7 @@ for py in python{2,3}; do
[ ${1:0:6} = python ] && [ $1 != $py ] && continue [ ${1:0:6} = python ] && [ $1 != $py ] && continue
PYTHONPATH= PYTHONPATH=
[ $py = python2 ] && PYTHONPATH=../scripts/py2 [ $py = python2 ] && PYTHONPATH=../scripts/py2:../sfx/py37
export PYTHONPATH export PYTHONPATH
nice $py -m unittest discover -s tests >/dev/null & nice $py -m unittest discover -s tests >/dev/null &

View file

@ -19,8 +19,8 @@ copyparty/httpconn.py,
copyparty/httpsrv.py, copyparty/httpsrv.py,
copyparty/ico.py, copyparty/ico.py,
copyparty/mdns.py, copyparty/mdns.py,
copyparty/multicast.py,
copyparty/mtag.py, copyparty/mtag.py,
copyparty/multicast.py,
copyparty/res, copyparty/res,
copyparty/res/COPYING.txt, copyparty/res/COPYING.txt,
copyparty/res/insecure.pem, copyparty/res/insecure.pem,
@ -59,6 +59,7 @@ copyparty/vend/asynchat.py,
copyparty/vend/asyncore.py, copyparty/vend/asyncore.py,
copyparty/web, copyparty/web,
copyparty/web/a, copyparty/web/a,
copyparty/web/a/__init__.py,
copyparty/web/a/partyfuse.py, copyparty/web/a/partyfuse.py,
copyparty/web/a/up2k.py, copyparty/web/a/up2k.py,
copyparty/web/a/webdav-cfg.bat, copyparty/web/a/webdav-cfg.bat,
@ -67,21 +68,23 @@ copyparty/web/browser.css,
copyparty/web/browser.html, copyparty/web/browser.html,
copyparty/web/browser.js, copyparty/web/browser.js,
copyparty/web/browser2.html, copyparty/web/browser2.html,
copyparty/web/copyparty.gif,
copyparty/web/cf.html, copyparty/web/cf.html,
copyparty/web/copyparty.gif,
copyparty/web/dd, copyparty/web/dd,
copyparty/web/dd/2.png, copyparty/web/dd/2.png,
copyparty/web/dd/3.png, copyparty/web/dd/3.png,
copyparty/web/dd/4.png, copyparty/web/dd/4.png,
copyparty/web/dd/5.png, copyparty/web/dd/5.png,
copyparty/web/dd/__init__.py,
copyparty/web/deps, copyparty/web/deps,
copyparty/web/deps/__init__.py,
copyparty/web/deps/easymde.css, copyparty/web/deps/easymde.css,
copyparty/web/deps/easymde.js, copyparty/web/deps/easymde.js,
copyparty/web/deps/marked.js, copyparty/web/deps/marked.js,
copyparty/web/deps/mini-fa.css, copyparty/web/deps/mini-fa.css,
copyparty/web/deps/mini-fa.woff, copyparty/web/deps/mini-fa.woff,
copyparty/web/deps/prism.js,
copyparty/web/deps/prism.css, copyparty/web/deps/prism.css,
copyparty/web/deps/prism.js,
copyparty/web/deps/prismd.css, copyparty/web/deps/prismd.css,
copyparty/web/deps/scp.woff2, copyparty/web/deps/scp.woff2,
copyparty/web/deps/sha512.ac.js, copyparty/web/deps/sha512.ac.js,

View file

@ -6,7 +6,7 @@ import os
import sys import sys
import subprocess as sp import subprocess as sp
from shutil import rmtree from shutil import rmtree
from setuptools import setup, Command, find_packages from setuptools import setup, Command
NAME = "copyparty" NAME = "copyparty"
@ -120,7 +120,18 @@ args = {
], ],
"include_package_data": True, "include_package_data": True,
"data_files": data_files, "data_files": data_files,
"packages": find_packages(), "packages": [
"copyparty",
"copyparty.bos",
"copyparty.res",
"copyparty.stolen",
"copyparty.stolen.dnslib",
"copyparty.stolen.ifaddr",
"copyparty.web",
"copyparty.web.a",
"copyparty.web.dd",
"copyparty.web.deps",
],
"install_requires": ["jinja2"], "install_requires": ["jinja2"],
"extras_require": { "extras_require": {
"thumbnails": ["Pillow"], "thumbnails": ["Pillow"],

View file

@ -90,7 +90,8 @@ class TestDXML(unittest.TestCase):
root = mkenod("a") root = mkenod("a")
root.insert(0, parse_xml(txt)) root.insert(0, parse_xml(txt))
prop = root.find(r"./{DAV:}propertyupdate/{DAV:}set/{DAV:}prop") prop = root.find(r"./{DAV:}propertyupdate/{DAV:}set/{DAV:}prop")
assert prop assert prop is not None
assert len(prop)
for el in prop: for el in prop:
el.clear() el.clear()

View file

@ -98,19 +98,19 @@ class Cfg(Namespace):
def __init__(self, a=None, v=None, c=None): def __init__(self, a=None, v=None, c=None):
ka = {} ka = {}
ex = "e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp no_dav daw dav_inf dav_mac xdev xvol ed emp force_js ihead magic no_acode no_athumb no_del no_logues no_mv no_readme no_robots no_scandir no_thumb no_vthumb no_zip nid nih nw" ex = "daw dav_inf dav_mac e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp force_js ihead magic nid nih no_acode no_athumb no_dav no_del no_dupe no_logues no_mv no_readme no_robots no_scandir no_thumb no_vthumb no_zip nw xdev xlink xvol"
ka.update(**{k: False for k in ex.split()}) ka.update(**{k: False for k in ex.split()})
ex = "no_rescan no_sendfile no_voldump plain_ip dotpart" ex = "dotpart no_rescan no_sendfile no_voldump plain_ip"
ka.update(**{k: True for k in ex.split()}) ka.update(**{k: True for k in ex.split()})
ex = "css_browser hist js_browser no_hash no_idx no_forget" ex = "css_browser hist js_browser no_forget no_hash no_idx"
ka.update(**{k: None for k in ex.split()}) ka.update(**{k: None for k in ex.split()})
ex = "re_maxage rproxy rsp_slp s_wr_slp theme themes turbo df loris" ex = "df loris re_maxage rproxy rsp_slp s_wr_slp theme themes turbo"
ka.update(**{k: 0 for k in ex.split()}) ka.update(**{k: 0 for k in ex.split()})
ex = "doctitle favico html_head mth textfiles log_fk" ex = "doctitle favico html_head log_fk mth textfiles"
ka.update(**{k: "" for k in ex.split()}) ka.update(**{k: "" for k in ex.split()})
super(Cfg, self).__init__( super(Cfg, self).__init__(