Skip to content

Commit

Permalink
release v0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed Jan 19, 2020
1 parent e301f1a commit a2d1787
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 93 deletions.
7 changes: 6 additions & 1 deletion bin/copyparty-fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@
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
Expand Down
2 changes: 1 addition & 1 deletion copyparty/__version__.py
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
35 changes: 16 additions & 19 deletions scripts/make-pypi-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
}


Expand All @@ -72,7 +69,7 @@ pydir="$(
sed -r 's@[^/]*$@@'
)"

[[ -e "$pydir/activate" ]] &&
[ -e "$pydir/activate" ] &&
{
echo '`deactivate` your virtualenv'
exit 1
Expand All @@ -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
Expand Down
96 changes: 24 additions & 72 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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
Expand All @@ -25,43 +25,25 @@
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__))

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 = {}
Expand Down Expand Up @@ -99,70 +81,30 @@ def run(self):
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)

for fn in nuke:
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": "[email protected]",
"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",
Expand All @@ -174,29 +116,39 @@ def proc_dir(self, path):
"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
Expand Down

0 comments on commit a2d1787

Please sign in to comment.