diff --git a/copyparty/web/a/__init__.py b/copyparty/web/a/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/copyparty/web/dd/__init__.py b/copyparty/web/dd/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/copyparty/web/deps/__init__.py b/copyparty/web/deps/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/scripts/make-pypi-release.bat b/scripts/make-pypi-release.bat deleted file mode 100644 index 6a3041a5..00000000 --- a/scripts/make-pypi-release.bat +++ /dev/null @@ -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 diff --git a/scripts/make-pypi-release.sh b/scripts/make-pypi-release.sh index 233b3589..74c1c005 100755 --- a/scripts/make-pypi-release.sh +++ b/scripts/make-pypi-release.sh @@ -55,14 +55,6 @@ EOF # set pypi password chmod 600 ~/.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__" } -. buildenv/bin/activate -have setuptools -have wheel -have twine +function load_env() { + . buildenv/bin/activate + have setuptools + have wheel + 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 rm -rf build/pypi mkdir -p 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 f=../strip-hints-0.1.10.tar.gz [ -e $f ] || diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 5680749a..834137d7 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -5,6 +5,24 @@ rm -rf unt mkdir -p unt/srv cp -pR copyparty tests 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 pids=() @@ -12,7 +30,7 @@ for py in python{2,3}; do [ ${1:0:6} = python ] && [ $1 != $py ] && continue PYTHONPATH= - [ $py = python2 ] && PYTHONPATH=../scripts/py2 + [ $py = python2 ] && PYTHONPATH=../scripts/py2:../sfx/py37 export PYTHONPATH nice $py -m unittest discover -s tests >/dev/null & diff --git a/scripts/sfx.ls b/scripts/sfx.ls index 0827f92b..34cff932 100644 --- a/scripts/sfx.ls +++ b/scripts/sfx.ls @@ -19,8 +19,8 @@ copyparty/httpconn.py, copyparty/httpsrv.py, copyparty/ico.py, copyparty/mdns.py, -copyparty/multicast.py, copyparty/mtag.py, +copyparty/multicast.py, copyparty/res, copyparty/res/COPYING.txt, copyparty/res/insecure.pem, @@ -59,6 +59,7 @@ copyparty/vend/asynchat.py, copyparty/vend/asyncore.py, copyparty/web, copyparty/web/a, +copyparty/web/a/__init__.py, copyparty/web/a/partyfuse.py, copyparty/web/a/up2k.py, copyparty/web/a/webdav-cfg.bat, @@ -67,21 +68,23 @@ copyparty/web/browser.css, copyparty/web/browser.html, copyparty/web/browser.js, copyparty/web/browser2.html, -copyparty/web/copyparty.gif, copyparty/web/cf.html, +copyparty/web/copyparty.gif, copyparty/web/dd, copyparty/web/dd/2.png, copyparty/web/dd/3.png, copyparty/web/dd/4.png, copyparty/web/dd/5.png, +copyparty/web/dd/__init__.py, copyparty/web/deps, +copyparty/web/deps/__init__.py, copyparty/web/deps/easymde.css, copyparty/web/deps/easymde.js, copyparty/web/deps/marked.js, copyparty/web/deps/mini-fa.css, copyparty/web/deps/mini-fa.woff, -copyparty/web/deps/prism.js, copyparty/web/deps/prism.css, +copyparty/web/deps/prism.js, copyparty/web/deps/prismd.css, copyparty/web/deps/scp.woff2, copyparty/web/deps/sha512.ac.js, diff --git a/setup.py b/setup.py index 55322890..92d77ff9 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import os import sys import subprocess as sp from shutil import rmtree -from setuptools import setup, Command, find_packages +from setuptools import setup, Command NAME = "copyparty" @@ -120,7 +120,18 @@ args = { ], "include_package_data": True, "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"], "extras_require": { "thumbnails": ["Pillow"], diff --git a/tests/test_dxml.py b/tests/test_dxml.py index c8ad4099..e3f67704 100644 --- a/tests/test_dxml.py +++ b/tests/test_dxml.py @@ -90,7 +90,8 @@ class TestDXML(unittest.TestCase): root = mkenod("a") root.insert(0, parse_xml(txt)) prop = root.find(r"./{DAV:}propertyupdate/{DAV:}set/{DAV:}prop") - assert prop + assert prop is not None + assert len(prop) for el in prop: el.clear() diff --git a/tests/util.py b/tests/util.py index efec3f94..4c38635e 100644 --- a/tests/util.py +++ b/tests/util.py @@ -98,19 +98,19 @@ class Cfg(Namespace): def __init__(self, a=None, v=None, c=None): 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()}) - 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()}) - 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()}) - 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()}) - 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()}) super(Cfg, self).__init__(