1
0
Fork 0
mirror of synced 2024-05-12 08:23:04 +12:00

cleanup sdist and bdist build process

This commit is contained in:
Nick Sweeting 2020-08-18 17:12:49 -04:00
parent 5ff852bd07
commit 87b79fe5e3
10 changed files with 61 additions and 68 deletions

View file

@ -1,5 +1,4 @@
graft LICENSE
graft README.md
graft package.json
graft package-lock.json
recursive-include archivebox/themes *
graft archivebox
global-exclude .DS_Store
global-exclude __pycache__
global-exclude *.pyc

View file

@ -1,14 +1,16 @@
LICENSE
MANIFEST.in
README.md
package-lock.json
package.json
setup.py
archivebox/.flake8
archivebox/LICENSE
archivebox/README.md
archivebox/__init__.py
archivebox/__main__.py
archivebox/logging_util.py
archivebox/main.py
archivebox/manage.py
archivebox/mypy.ini
archivebox/package.json
archivebox/system.py
archivebox/util.py
archivebox.egg-info/PKG-INFO
@ -46,6 +48,7 @@ archivebox/core/urls.py
archivebox/core/views.py
archivebox/core/welcome_message.py
archivebox/core/wsgi.py
archivebox/core/management/commands/archivebox.py
archivebox/core/migrations/0001_initial.py
archivebox/core/migrations/0002_auto_20200625_1521.py
archivebox/core/migrations/0003_auto_20200630_1034.py
@ -111,16 +114,4 @@ archivebox/themes/legacy/static/jquery.min.js
archivebox/themes/legacy/static/sort_asc.png
archivebox/themes/legacy/static/sort_both.png
archivebox/themes/legacy/static/sort_desc.png
archivebox/themes/legacy/static/spinner.gif
tests/__init__.py
tests/conftest.py
tests/fixtures.py
tests/test_args.py
tests/test_extractors.py
tests/test_init.py
tests/test_oneshot.py
tests/test_remove.py
tests/test_title.py
tests/test_util.py
tests/mock_server/__init__.py
tests/mock_server/server.py
archivebox/themes/legacy/static/spinner.gif

View file

@ -1,2 +1 @@
archivebox
tests

1
archivebox/LICENSE Symbolic link
View file

@ -0,0 +1 @@
../LICENSE

1
archivebox/README.md Symbolic link
View file

@ -0,0 +1 @@
../README.md

View file

@ -234,7 +234,7 @@ DERIVED_CONFIG_DEFAULTS: ConfigDefaultDict = {
'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: json.loads((Path(c['REPO_DIR']) / 'package.json').read_text().strip())['version']},
'VERSION': {'default': lambda c: json.loads((Path(c['PYTHON_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},

1
archivebox/package.json Symbolic link
View file

@ -0,0 +1 @@
../package.json

View file

@ -50,10 +50,10 @@ git add "$REPO_DIR/package-lock.json"
echo "[*] Cleaning up build dirs"
cd "$REPO_DIR"
rm -Rf build dist
rm -Rf build dist archivebox.egg-info
echo "[+] Building sdist and bdist_wheel"
python3 setup.py sdist bdist_wheel
python3 setup.py sdist bdist_egg bdist_wheel
echo "[^] Pushing source to github"
git add "$REPO_DIR/archivebox.egg-info"

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "archivebox",
"version": "0.4.18",
"version": "0.4.19",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,56 +1,57 @@
import sys
# import sys
import json
import setuptools
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
# 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"
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 = json.loads((BASE_DIR / "package.json").read_text().strip())['version']
REPO_DIR = Path(__file__).parent.resolve()
PYTHON_DIR = REPO_DIR / PKG_NAME
README = (PYTHON_DIR / "README.md").read_text()
VERSION = json.loads((PYTHON_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
# print(SOURCE_DIR, f" (v{VERSION})")
# print(PYTHON_DIR, f" (v{VERSION})")
# print('>', sys.executable, *sys.argv)
# Sketchy way to install npm dependencies as a pip post-install script
def setup_js():
if sys.platform.lower() not in ('darwin', 'linux'):
sys.stderr.write('[!] Warning: ArchiveBox is not supported on this platform.\n')
# def setup_js():
# if sys.platform.lower() not in ('darwin', 'linux'):
# sys.stderr.write('[!] Warning: ArchiveBox is not officially 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')
# sys.stderr.write(f'[+] Installing ArchiveBox npm package (PYTHON_DIR={PYTHON_DIR})...\n')
# try:
# check_call(f'npm install -g "{REPO_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 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()
# class CustomDevelopCommand(develop):
# def run(self):
# super().run()
# setup_js()
# class CustomEggInfoCommand(egg_info):
# def run(self):
# super().run()
# setup_js()
setuptools.setup(
name=PKG_NAME,
@ -110,18 +111,18 @@ setuptools.setup(
# 'redis': ['redis', 'django-redis'],
# 'pywb': ['pywb', 'redis'],
},
packages=setuptools.find_packages(),
packages=['archivebox'],
include_package_data=True, # see MANIFEST.in
entry_points={
"console_scripts": [
f"{PKG_NAME} = {PKG_NAME}.cli:main",
],
},
include_package_data=True,
cmdclass={
'install': CustomInstallCommand,
'develop': CustomDevelopCommand,
'egg_info': CustomEggInfoCommand,
},
# cmdclass={
# 'install': CustomInstallCommand,
# 'develop': CustomDevelopCommand,
# 'egg_info': CustomEggInfoCommand,
# },
classifiers=[
"License :: OSI Approved :: MIT License",
"Natural Language :: English",