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 archivebox
graft README.md global-exclude .DS_Store
graft package.json global-exclude __pycache__
graft package-lock.json global-exclude *.pyc
recursive-include archivebox/themes *

View file

@ -1,14 +1,16 @@
LICENSE
MANIFEST.in MANIFEST.in
README.md README.md
package-lock.json
package.json
setup.py setup.py
archivebox/.flake8
archivebox/LICENSE
archivebox/README.md
archivebox/__init__.py archivebox/__init__.py
archivebox/__main__.py archivebox/__main__.py
archivebox/logging_util.py archivebox/logging_util.py
archivebox/main.py archivebox/main.py
archivebox/manage.py archivebox/manage.py
archivebox/mypy.ini
archivebox/package.json
archivebox/system.py archivebox/system.py
archivebox/util.py archivebox/util.py
archivebox.egg-info/PKG-INFO archivebox.egg-info/PKG-INFO
@ -46,6 +48,7 @@ archivebox/core/urls.py
archivebox/core/views.py archivebox/core/views.py
archivebox/core/welcome_message.py archivebox/core/welcome_message.py
archivebox/core/wsgi.py archivebox/core/wsgi.py
archivebox/core/management/commands/archivebox.py
archivebox/core/migrations/0001_initial.py archivebox/core/migrations/0001_initial.py
archivebox/core/migrations/0002_auto_20200625_1521.py archivebox/core/migrations/0002_auto_20200625_1521.py
archivebox/core/migrations/0003_auto_20200630_1034.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_asc.png
archivebox/themes/legacy/static/sort_both.png archivebox/themes/legacy/static/sort_both.png
archivebox/themes/legacy/static/sort_desc.png archivebox/themes/legacy/static/sort_desc.png
archivebox/themes/legacy/static/spinner.gif 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

View file

@ -1,2 +1 @@
archivebox 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)}, '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: 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'}, '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},

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" echo "[*] Cleaning up build dirs"
cd "$REPO_DIR" cd "$REPO_DIR"
rm -Rf build dist rm -Rf build dist archivebox.egg-info
echo "[+] Building sdist and bdist_wheel" 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" echo "[^] Pushing source to github"
git add "$REPO_DIR/archivebox.egg-info" git add "$REPO_DIR/archivebox.egg-info"

2
package-lock.json generated
View file

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

View file

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