get VERSION from package.json instead of VERSION to avoid duplication
This commit is contained in:
parent
8e07fe3f2e
commit
8b427c9d79
8 changed files with 31 additions and 28 deletions
|
@ -1,4 +1,5 @@
|
||||||
include LICENSE
|
include LICENSE
|
||||||
include README.md
|
include README.md
|
||||||
include archivebox/VERSION
|
include package.json
|
||||||
|
include package-lock.json
|
||||||
recursive-include archivebox/themes *
|
recursive-include archivebox/themes *
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
LICENSE
|
LICENSE
|
||||||
MANIFEST.in
|
MANIFEST.in
|
||||||
README.md
|
README.md
|
||||||
|
package-lock.json
|
||||||
|
package.json
|
||||||
setup.py
|
setup.py
|
||||||
archivebox/VERSION
|
|
||||||
archivebox/__init__.py
|
archivebox/__init__.py
|
||||||
archivebox/__main__.py
|
archivebox/__main__.py
|
||||||
archivebox/logging_util.py
|
archivebox/logging_util.py
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
0.4.17
|
|
|
@ -4,10 +4,11 @@ import os
|
||||||
import io
|
import io
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import django
|
import json
|
||||||
import getpass
|
import getpass
|
||||||
import shutil
|
import shutil
|
||||||
import platform
|
import platform
|
||||||
|
import django
|
||||||
|
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -185,7 +186,6 @@ STATICFILE_EXTENSIONS = {
|
||||||
# html, htm, shtml, xhtml, xml, aspx, php, cgi
|
# html, htm, shtml, xhtml, xml, aspx, php, cgi
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION_FILENAME = 'VERSION'
|
|
||||||
PYTHON_DIR_NAME = 'archivebox'
|
PYTHON_DIR_NAME = 'archivebox'
|
||||||
TEMPLATES_DIR_NAME = 'themes'
|
TEMPLATES_DIR_NAME = 'themes'
|
||||||
|
|
||||||
|
@ -231,10 +231,10 @@ DERIVED_CONFIG_DEFAULTS: ConfigDefaultDict = {
|
||||||
'CONFIG_FILE': {'default': lambda c: os.path.abspath(os.path.expanduser(c['CONFIG_FILE'])) if c['CONFIG_FILE'] else os.path.join(c['OUTPUT_DIR'], CONFIG_FILENAME)},
|
'CONFIG_FILE': {'default': lambda c: os.path.abspath(os.path.expanduser(c['CONFIG_FILE'])) if c['CONFIG_FILE'] else os.path.join(c['OUTPUT_DIR'], CONFIG_FILENAME)},
|
||||||
'COOKIES_FILE': {'default': lambda c: c['COOKIES_FILE'] and os.path.abspath(os.path.expanduser(c['COOKIES_FILE']))},
|
'COOKIES_FILE': {'default': lambda c: c['COOKIES_FILE'] and os.path.abspath(os.path.expanduser(c['COOKIES_FILE']))},
|
||||||
'CHROME_USER_DATA_DIR': {'default': lambda c: find_chrome_data_dir() if c['CHROME_USER_DATA_DIR'] is None else (os.path.abspath(os.path.expanduser(c['CHROME_USER_DATA_DIR'])) or None)},
|
'CHROME_USER_DATA_DIR': {'default': lambda c: find_chrome_data_dir() if c['CHROME_USER_DATA_DIR'] is None else (os.path.abspath(os.path.expanduser(c['CHROME_USER_DATA_DIR'])) or None)},
|
||||||
'URL_BLACKLIST_PTN': {'default': lambda c: c['URL_BLACKLIST'] and re.compile(c['URL_BLACKLIST'], re.IGNORECASE | re.UNICODE | re.MULTILINE)},
|
'URL_BLACKLIST_PTN': {'default': lambda c: c['URL_BLACKLIST'] and re.compile(c['URL_BLACKLIST'] or '', re.IGNORECASE | re.UNICODE | re.MULTILINE)},
|
||||||
|
|
||||||
'ARCHIVEBOX_BINARY': {'default': lambda c: sys.argv[0]},
|
'ARCHIVEBOX_BINARY': {'default': lambda c: sys.argv[0]},
|
||||||
'VERSION': {'default': lambda c: open(os.path.join(c['PYTHON_DIR'], VERSION_FILENAME), 'r').read().strip()},
|
'VERSION': {'default': lambda c: json.loads((Path(c['REPO_DIR']) / 'package.json').read_text().strip())['version']},
|
||||||
'GIT_SHA': {'default': lambda c: c['VERSION'].split('+')[-1] or 'unknown'},
|
'GIT_SHA': {'default': lambda c: c['VERSION'].split('+')[-1] or 'unknown'},
|
||||||
|
|
||||||
'PYTHON_BINARY': {'default': lambda c: sys.executable},
|
'PYTHON_BINARY': {'default': lambda c: sys.executable},
|
||||||
|
|
|
@ -10,29 +10,28 @@ set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||||
VERSION_FILE="$DIR/archivebox/VERSION"
|
|
||||||
|
|
||||||
function bump_semver {
|
function bump_semver {
|
||||||
echo "$1" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
|
echo "$1" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
|
||||||
}
|
}
|
||||||
|
|
||||||
source "$DIR/.venv/bin/activate"
|
source "$REPO_DIR/.venv/bin/activate"
|
||||||
cd "$DIR"
|
cd "$REPO_DIR"
|
||||||
|
|
||||||
OLD_VERSION="$(cat "$VERSION_FILE")"
|
OLD_VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||||
NEW_VERSION="$(bump_semver "$OLD_VERSION")"
|
NEW_VERSION="$(bump_semver "$OLD_VERSION")"
|
||||||
|
|
||||||
echo "[*] Fetching latest docs version"
|
echo "[*] Fetching latest docs version"
|
||||||
cd "$DIR/docs"
|
cd "$REPO_DIR/docs"
|
||||||
git pull
|
git pull
|
||||||
cd "$DIR"
|
cd "$REPO_DIR"
|
||||||
|
|
||||||
echo "[+] Building docs"
|
echo "[+] Building docs"
|
||||||
sphinx-apidoc -o docs archivebox
|
sphinx-apidoc -o docs archivebox
|
||||||
cd "$DIR/docs"
|
cd "$REPO_DIR/docs"
|
||||||
make html
|
make html
|
||||||
cd "$DIR"
|
cd "$REPO_DIR"
|
||||||
|
|
||||||
if [ -z "$(git status --porcelain)" ] && [[ "$(git branch --show-current)" == "master" ]]; then
|
if [ -z "$(git status --porcelain)" ] && [[ "$(git branch --show-current)" == "master" ]]; then
|
||||||
git pull
|
git pull
|
||||||
|
@ -43,19 +42,20 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[*] Bumping VERSION from $OLD_VERSION to $NEW_VERSION"
|
echo "[*] Bumping VERSION from $OLD_VERSION to $NEW_VERSION"
|
||||||
echo "$NEW_VERSION" > "$VERSION_FILE"
|
contents="$(jq ".version = \"$NEW_VERSION\"" "$REPO_DIR/package.json")" && \
|
||||||
git add "$DIR/docs"
|
echo "${contents}" > package.json
|
||||||
|
git add "$REPO_DIR/docs"
|
||||||
git add "$VERSION_FILE"
|
git add "$VERSION_FILE"
|
||||||
|
|
||||||
echo "[*] Cleaning up build dirs"
|
echo "[*] Cleaning up build dirs"
|
||||||
cd "$DIR"
|
cd "$REPO_DIR"
|
||||||
rm -Rf build dist
|
rm -Rf build dist
|
||||||
|
|
||||||
echo "[+] Building sdist and bdist_wheel"
|
echo "[+] Building sdist and bdist_wheel"
|
||||||
python3 setup.py sdist bdist_wheel
|
python3 setup.py sdist bdist_wheel
|
||||||
|
|
||||||
echo "[^] Pushing source to github"
|
echo "[^] Pushing source to github"
|
||||||
git add "$DIR/archivebox.egg-info"
|
git add "$REPO_DIR/archivebox.egg-info"
|
||||||
git commit -m "$NEW_VERSION release"
|
git commit -m "$NEW_VERSION release"
|
||||||
git tag -a "v$NEW_VERSION" -m "v$NEW_VERSION"
|
git tag -a "v$NEW_VERSION" -m "v$NEW_VERSION"
|
||||||
git push origin master
|
git push origin master
|
||||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -902,7 +902,7 @@
|
||||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
|
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
|
||||||
},
|
},
|
||||||
"readability-extractor": {
|
"readability-extractor": {
|
||||||
"version": "git+https://github.com/pirate/readability-extractor.git#afa6a5bb8473f629ee3f1e0dcbf093b73d4eff40",
|
"version": "git+https://github.com/pirate/readability-extractor.git#0098f142b0a015c8c90766d3b74d9eb6fb7b7e6a",
|
||||||
"from": "git+https://github.com/pirate/readability-extractor.git",
|
"from": "git+https://github.com/pirate/readability-extractor.git",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@mozilla/readability": "^0.3.0",
|
"@mozilla/readability": "^0.3.0",
|
||||||
|
@ -1054,7 +1054,7 @@
|
||||||
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E="
|
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E="
|
||||||
},
|
},
|
||||||
"single-file": {
|
"single-file": {
|
||||||
"version": "git+https://github.com/gildas-lormeau/SingleFile.git#27c1ba673979f593b3c2c6cd353634bf869743f9",
|
"version": "git+https://github.com/gildas-lormeau/SingleFile.git#e2e15381a6cbb9c3a6ca0ea8ff7307174e98ad12",
|
||||||
"from": "git+https://github.com/gildas-lormeau/SingleFile.git",
|
"from": "git+https://github.com/gildas-lormeau/SingleFile.git",
|
||||||
"requires": {
|
"requires": {
|
||||||
"file-url": "^3.0.0",
|
"file-url": "^3.0.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "archivebox",
|
"name": "archivebox",
|
||||||
"version": "0.4.14",
|
"version": "0.4.17",
|
||||||
"description": "ArchiveBox: The self-hosted internet archive",
|
"description": "ArchiveBox: The self-hosted internet archive",
|
||||||
"author": "Nick Sweeting <archivebox-npm@sweeting.me>",
|
"author": "Nick Sweeting <archivebox-npm@sweeting.me>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -9,8 +9,8 @@
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"archivebox-node": "./bin/archive",
|
"archivebox-node": "./bin/archive",
|
||||||
"single-file": "single-file",
|
"single-file": "./node_modules/.bin/single-file",
|
||||||
"readability-extractor": "single-file"
|
"readability-extractor": "./node_modules/.bin/single-file"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"readability-extractor": "git+https://github.com/pirate/readability-extractor.git",
|
"readability-extractor": "git+https://github.com/pirate/readability-extractor.git",
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -1,4 +1,6 @@
|
||||||
|
import json
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
PKG_NAME = "archivebox"
|
PKG_NAME = "archivebox"
|
||||||
|
@ -6,13 +8,13 @@ REPO_URL = "https://github.com/pirate/ArchiveBox"
|
||||||
BASE_DIR = Path(__file__).parent.resolve()
|
BASE_DIR = Path(__file__).parent.resolve()
|
||||||
SOURCE_DIR = BASE_DIR / PKG_NAME
|
SOURCE_DIR = BASE_DIR / PKG_NAME
|
||||||
README = (BASE_DIR / "README.md").read_text()
|
README = (BASE_DIR / "README.md").read_text()
|
||||||
VERSION = (SOURCE_DIR / "VERSION").read_text().strip()
|
VERSION = json.loads((BASE_DIR / "package.json").read_text().strip())['version']
|
||||||
|
|
||||||
# To see when setup.py gets called (uncomment for debugging)
|
# To see when setup.py gets called (uncomment for debugging)
|
||||||
# import sys
|
# import sys
|
||||||
# print(SOURCE_DIR, f" (v{VERSION})")
|
# print(SOURCE_DIR, f" (v{VERSION})")
|
||||||
# print('>', sys.executable, *sys.argv)
|
# print('>', sys.executable, *sys.argv)
|
||||||
# raise SystemExit(0)
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name=PKG_NAME,
|
name=PKG_NAME,
|
||||||
|
|
Loading…
Reference in a new issue