release v0.2.3

This commit is contained in:
ed 2020-01-19 16:12:59 +01:00
parent e301f1a232
commit a2d1787c84
4 changed files with 47 additions and 93 deletions

View file

@ -17,9 +17,14 @@ import threading
import http.client # py2: httplib
import urllib.parse
from datetime import datetime
from fuse import FUSE, FuseOSError, Operations
from urllib.parse import quote_from_bytes as quote
try:
from fuse import FUSE, FuseOSError, Operations
except:
print("\n could not import fuse;\n pip install fusepy\n")
raise
"""
mount a copyparty server (local or remote) as a filesystem

View file

@ -1,6 +1,6 @@
# coding: utf-8
VERSION = (0, 2, 1)
VERSION = (0, 2, 3)
BUILD_DT = (2020, 1, 19)
S_VERSION = ".".join(map(str, VERSION))

View file

@ -13,15 +13,15 @@ which md5sum 2>/dev/null >/dev/null &&
mode="$1"
[[ "x$mode" == x ]] &&
[ -z "$mode" ] &&
{
echo "need argument 1: (D)ry or (U)pload"
echo "need argument 1: (D)ry, (T)est, (U)pload"
echo
exit 1
}
[[ -e copyparty/__main__.py ]] || cd ..
[[ -e copyparty/__main__.py ]] ||
[ -e copyparty/__main__.py ] || cd ..
[ -e copyparty/__main__.py ] ||
{
echo "run me from within the copyparty folder"
echo
@ -39,13 +39,14 @@ index-servers =
pypitest
[pypi]
username=qwer
password=asdf
repository: https://upload.pypi.org/legacy/
username: qwer
password: asdf
[pypitest]
repository: https://test.pypi.org/legacy/
username=qwer
password=asdf
username: qwer
password: asdf
EOF
# set pypi password
@ -54,15 +55,11 @@ EOF
# if PY2: create build env
cd ~/dev/copyparty && virtualenv buildenv
(. buildenv/bin/activate && pip install m2r)
(. buildenv/bin/activate && pip install twine)
# if PY3: create build env
cd ~/dev/copyparty && python3 -m venv buildenv
(. buildenv/bin/activate && pip install m2r wheel)
# test rst
pip install docutils
./setup.py --long-description | tee ~/Desktop/rst | rst2html.py > ~/Desktop/rst.html
(. buildenv/bin/activate && pip install twine wheel)
}
@ -72,7 +69,7 @@ pydir="$(
sed -r 's@[^/]*$@@'
)"
[[ -e "$pydir/activate" ]] &&
[ -e "$pydir/activate" ] &&
{
echo '`deactivate` your virtualenv'
exit 1
@ -85,12 +82,12 @@ function have() {
. buildenv/bin/activate
have setuptools
have wheel
have m2r
have twine
./setup.py clean2
./setup.py rstconv
./setup.py sdist bdist_wheel --universal
[[ "x$mode" == "xu" ]] &&
./setup.py sdist bdist_wheel upload -r pypi
[ "$mode" == t ] && twine upload -r pypitest dist/*
[ "$mode" == u ] && twine upload -r pypi dist/*
cat <<EOF

View file

@ -11,7 +11,7 @@ from shutil import rmtree
setuptools_available = True
try:
# need setuptools to build wheel
from setuptools import setup, Command
from setuptools import setup, Command, find_packages
except ImportError:
# works in a pinch
@ -25,21 +25,15 @@ if "bdist_wheel" in sys.argv and not setuptools_available:
sys.exit(1)
def mglob(dirname, extensions):
ret = []
for ext in extensions:
ret.extend(glob(dirname + "/*." + ext))
return ret
NAME = "copyparty"
VERSION = None
data_files = [("share/doc/copyparty", ["README.rst", "README.md", "LICENSE"])]
data_files = [("share/doc/copyparty", ["README.md", "LICENSE"])]
manifest = ""
for dontcare, files in data_files:
for fn in files:
manifest += "include {0}\n".format(fn)
manifest += "recursive-include copyparty/res *\n"
manifest += "recursive-include copyparty/web *\n"
here = os.path.abspath(os.path.dirname(__file__))
@ -47,21 +41,9 @@ here = os.path.abspath(os.path.dirname(__file__))
with open(here + "/MANIFEST.in", "wb") as f:
f.write(manifest.encode("utf-8"))
try:
LONG_DESCRIPTION = ""
LDCT = ""
with open(here + "/README.rst", "rb") as f:
txt = f.read().decode("utf-8")
txt = txt[txt.find("`") :]
LONG_DESCRIPTION = txt
LDCT = "text/x-rst"
except:
print("\n### could not open README.rst ###\n")
with open(here + "/README.md", "rb") as f:
txt = f.read().decode("utf-8")
LONG_DESCRIPTION = txt
LDCT = "text/markdown"
with open(here + "/README.md", "rb") as f:
txt = f.read().decode("utf-8")
long_description = txt
about = {}
@ -99,11 +81,10 @@ class clean2(Command):
for (dirpath, dirnames, filenames) in os.walk("."):
for fn in filenames:
if (
fn.endswith(".rst")
fn.startswith("MANIFEST")
or fn.endswith(".pyc")
or fn.endswith(".pyo")
or fn.endswith(".pyd")
or fn.startswith("MANIFEST")
):
nuke.append(dirpath + "/" + fn)
@ -111,58 +92,19 @@ class clean2(Command):
os.unlink(fn)
class rstconv(Command):
description = "Converts markdown to rst"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
self.proc_dir(".")
self.proc_dir("docs")
def proc_dir(self, path):
import m2r
for (dirpath, dirnames, filenames) in os.walk(path):
dirnames.sort()
for fn in sorted(filenames):
fn = dirpath + "/" + fn
if not fn.endswith(".md"):
continue
rst_fn = fn[:-3] + ".rst"
with open(fn, "rb") as f:
md = f.read().decode("utf-8")
md = md.replace("* **[", "* [").replace(")** <-", ") <-")
rst = m2r.convert(md)
rst = rst.replace(":raw-html-m2r:`<del>", ":sub:`")
rst = rst.replace("</del>`", "`")
with open(rst_fn, "wb") as f:
f.write(rst.encode("utf-8"))
args = {
"name": NAME,
"version": about["__version__"],
"description": "http file sharing hub",
"long_description": LONG_DESCRIPTION,
"long_description_content_type": LDCT,
"long_description": long_description,
"long_description_content_type": "text/markdown",
"author": "ed",
"author_email": "copyparty@ocv.me",
"url": "https://github.com/9001/copyparty",
"license": "MIT",
"data_files": data_files,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
@ -174,29 +116,39 @@ args = {
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Environment :: Console",
"Topic :: Communications :: Chat",
"Environment :: No Input/Output (Daemon)",
"Topic :: Communications :: File Sharing",
],
"cmdclass": {"rstconv": rstconv, "clean2": clean2},
"cmdclass": {"clean2": clean2},
}
if setuptools_available:
args.update(
{
"packages": ["copyparty"],
"packages": find_packages(),
"install_requires": ["jinja2"],
"extras_require": {"thumbnails": ["Pillow"]},
"include_package_data": True,
"entry_points": {
"console_scripts": ["copyparty = copyparty.__main__:main"]
},
"scripts": [
"bin/copyparty-fuse.py"
]
}
)
else:
args.update({"packages": ["copyparty"], "scripts": ["bin/copyparty"]})
args.update(
{
"packages": ["copyparty", "copyparty.stolen"],
"scripts": ["bin/copyparty", "bin/copyparty-fuse.py"]
}
)
# import pprint