mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
fix version parsing and attempt to npm install during pip post_install
This commit is contained in:
parent
9d7541ba47
commit
73408fb035
4 changed files with 50 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
||||||
include LICENSE
|
graft LICENSE
|
||||||
include README.md
|
graft README.md
|
||||||
include package.json
|
graft package.json
|
||||||
include package-lock.json
|
graft package-lock.json
|
||||||
recursive-include archivebox/themes *
|
recursive-include archivebox/themes *
|
||||||
|
|
|
@ -104,11 +104,11 @@ def main(args: Optional[List[str]]=NotProvided, stdin: Optional[IO]=NotProvided,
|
||||||
)
|
)
|
||||||
command = parser.parse_args(args or ())
|
command = parser.parse_args(args or ())
|
||||||
|
|
||||||
if command.help or command.subcommand is None:
|
if command.version:
|
||||||
command.subcommand = 'help'
|
|
||||||
elif command.version:
|
|
||||||
command.subcommand = 'version'
|
command.subcommand = 'version'
|
||||||
|
elif command.help or command.subcommand is None:
|
||||||
|
command.subcommand = 'help'
|
||||||
|
|
||||||
if command.subcommand not in ('help', 'version', 'status'):
|
if command.subcommand not in ('help', 'version', 'status'):
|
||||||
from ..logging_util import log_cli_command
|
from ..logging_util import log_cli_command
|
||||||
|
|
||||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "archivebox",
|
"name": "archivebox",
|
||||||
"version": "0.4.14",
|
"version": "0.4.18",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
41
setup.py
41
setup.py
|
@ -1,7 +1,13 @@
|
||||||
|
import sys
|
||||||
import json
|
import json
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from subprocess import check_call
|
||||||
|
from setuptools.command.install import install
|
||||||
|
from setuptools.command.develop import develop
|
||||||
|
from setuptools.command.egg_info import egg_info
|
||||||
|
|
||||||
|
|
||||||
PKG_NAME = "archivebox"
|
PKG_NAME = "archivebox"
|
||||||
REPO_URL = "https://github.com/pirate/ArchiveBox"
|
REPO_URL = "https://github.com/pirate/ArchiveBox"
|
||||||
|
@ -16,6 +22,36 @@ VERSION = json.loads((BASE_DIR / "package.json").read_text().strip())['version']
|
||||||
# print('>', sys.executable, *sys.argv)
|
# print('>', sys.executable, *sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
def setup_js():
|
||||||
|
if sys.platform.lower() not in ('darwin', 'linux'):
|
||||||
|
sys.stderr.write('[!] Warning: ArchiveBox is not supported on this platform.\n')
|
||||||
|
|
||||||
|
sys.stderr.write(f'[+] Installing ArchiveBox npm package (BASE_DIR={BASE_DIR})...\n')
|
||||||
|
try:
|
||||||
|
check_call(f'which npm && npm --version && npm install --global "{BASE_DIR}"', shell=True)
|
||||||
|
sys.stderr.write('[√] Automatically installed npm dependencies.\n')
|
||||||
|
except Exception as err:
|
||||||
|
sys.stderr.write(f'[!] Failed to auto-install npm dependencies: {err}\n')
|
||||||
|
sys.stderr.write(' Install NPM/npm using your system package manager, then run:\n')
|
||||||
|
sys.stderr.write(' npm install -g "git+https://github.com/pirate/ArchiveBox.git\n')
|
||||||
|
|
||||||
|
|
||||||
|
class CustomInstallCommand(install):
|
||||||
|
def run(self):
|
||||||
|
super().run()
|
||||||
|
setup_js()
|
||||||
|
|
||||||
|
class CustomDevelopCommand(develop):
|
||||||
|
def run(self):
|
||||||
|
super().run()
|
||||||
|
setup_js()
|
||||||
|
|
||||||
|
class CustomEggInfoCommand(egg_info):
|
||||||
|
def run(self):
|
||||||
|
super().run()
|
||||||
|
setup_js()
|
||||||
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name=PKG_NAME,
|
name=PKG_NAME,
|
||||||
version=VERSION,
|
version=VERSION,
|
||||||
|
@ -81,6 +117,11 @@ setuptools.setup(
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
cmdclass={
|
||||||
|
'install': CustomInstallCommand,
|
||||||
|
'develop': CustomDevelopCommand,
|
||||||
|
'egg_info': CustomEggInfoCommand,
|
||||||
|
},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue