mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 06:34:16 +00:00
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 README.md
|
||||
include archivebox/VERSION
|
||||
include package.json
|
||||
include package-lock.json
|
||||
recursive-include archivebox/themes *
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
LICENSE
|
||||
MANIFEST.in
|
||||
README.md
|
||||
package-lock.json
|
||||
package.json
|
||||
setup.py
|
||||
archivebox/VERSION
|
||||
archivebox/__init__.py
|
||||
archivebox/__main__.py
|
||||
archivebox/logging_util.py
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
0.4.17
|
|
@ -4,10 +4,11 @@ import os
|
|||
import io
|
||||
import re
|
||||
import sys
|
||||
import django
|
||||
import json
|
||||
import getpass
|
||||
import shutil
|
||||
import platform
|
||||
import django
|
||||
|
||||
from hashlib import md5
|
||||
from pathlib import Path
|
||||
|
@ -185,7 +186,6 @@ STATICFILE_EXTENSIONS = {
|
|||
# html, htm, shtml, xhtml, xml, aspx, php, cgi
|
||||
}
|
||||
|
||||
VERSION_FILENAME = 'VERSION'
|
||||
PYTHON_DIR_NAME = 'archivebox'
|
||||
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)},
|
||||
'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)},
|
||||
'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]},
|
||||
'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'},
|
||||
|
||||
'PYTHON_BINARY': {'default': lambda c: sys.executable},
|
||||
|
|
|
@ -10,29 +10,28 @@ set -o nounset
|
|||
set -o pipefail
|
||||
IFS=$'\n'
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
VERSION_FILE="$DIR/archivebox/VERSION"
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
|
||||
function bump_semver {
|
||||
echo "$1" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
|
||||
}
|
||||
|
||||
source "$DIR/.venv/bin/activate"
|
||||
cd "$DIR"
|
||||
source "$REPO_DIR/.venv/bin/activate"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
OLD_VERSION="$(cat "$VERSION_FILE")"
|
||||
OLD_VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
NEW_VERSION="$(bump_semver "$OLD_VERSION")"
|
||||
|
||||
echo "[*] Fetching latest docs version"
|
||||
cd "$DIR/docs"
|
||||
cd "$REPO_DIR/docs"
|
||||
git pull
|
||||
cd "$DIR"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
echo "[+] Building docs"
|
||||
sphinx-apidoc -o docs archivebox
|
||||
cd "$DIR/docs"
|
||||
cd "$REPO_DIR/docs"
|
||||
make html
|
||||
cd "$DIR"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
if [ -z "$(git status --porcelain)" ] && [[ "$(git branch --show-current)" == "master" ]]; then
|
||||
git pull
|
||||
|
@ -43,19 +42,20 @@ else
|
|||
fi
|
||||
|
||||
echo "[*] Bumping VERSION from $OLD_VERSION to $NEW_VERSION"
|
||||
echo "$NEW_VERSION" > "$VERSION_FILE"
|
||||
git add "$DIR/docs"
|
||||
contents="$(jq ".version = \"$NEW_VERSION\"" "$REPO_DIR/package.json")" && \
|
||||
echo "${contents}" > package.json
|
||||
git add "$REPO_DIR/docs"
|
||||
git add "$VERSION_FILE"
|
||||
|
||||
echo "[*] Cleaning up build dirs"
|
||||
cd "$DIR"
|
||||
cd "$REPO_DIR"
|
||||
rm -Rf build dist
|
||||
|
||||
echo "[+] Building sdist and bdist_wheel"
|
||||
python3 setup.py sdist bdist_wheel
|
||||
|
||||
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 tag -a "v$NEW_VERSION" -m "v$NEW_VERSION"
|
||||
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=="
|
||||
},
|
||||
"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",
|
||||
"requires": {
|
||||
"@mozilla/readability": "^0.3.0",
|
||||
|
@ -1054,7 +1054,7 @@
|
|||
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E="
|
||||
},
|
||||
"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",
|
||||
"requires": {
|
||||
"file-url": "^3.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "archivebox",
|
||||
"version": "0.4.14",
|
||||
"version": "0.4.17",
|
||||
"description": "ArchiveBox: The self-hosted internet archive",
|
||||
"author": "Nick Sweeting <archivebox-npm@sweeting.me>",
|
||||
"license": "MIT",
|
||||
|
@ -8,9 +8,9 @@
|
|||
"archivebox": "./bin/archive"
|
||||
},
|
||||
"bin": {
|
||||
"archivebox-node": "./bin/archive",
|
||||
"single-file": "single-file",
|
||||
"readability-extractor": "single-file"
|
||||
"archivebox-node": "./bin/archive",
|
||||
"single-file": "./node_modules/.bin/single-file",
|
||||
"readability-extractor": "./node_modules/.bin/single-file"
|
||||
},
|
||||
"dependencies": {
|
||||
"readability-extractor": "git+https://github.com/pirate/readability-extractor.git",
|
||||
|
|
6
setup.py
6
setup.py
|
@ -1,4 +1,6 @@
|
|||
import json
|
||||
import setuptools
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
PKG_NAME = "archivebox"
|
||||
|
@ -6,13 +8,13 @@ REPO_URL = "https://github.com/pirate/ArchiveBox"
|
|||
BASE_DIR = Path(__file__).parent.resolve()
|
||||
SOURCE_DIR = BASE_DIR / PKG_NAME
|
||||
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)
|
||||
# import sys
|
||||
# print(SOURCE_DIR, f" (v{VERSION})")
|
||||
# print('>', sys.executable, *sys.argv)
|
||||
# raise SystemExit(0)
|
||||
|
||||
|
||||
setuptools.setup(
|
||||
name=PKG_NAME,
|
||||
|
|
Loading…
Reference in a new issue