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 http.client # py2: httplib
import urllib.parse import urllib.parse
from datetime import datetime from datetime import datetime
from fuse import FUSE, FuseOSError, Operations
from urllib.parse import quote_from_bytes as quote 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 mount a copyparty server (local or remote) as a filesystem

View file

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

View file

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

View file

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