From 87b79fe5e3ed840818d563b91de63381e052b9af Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Tue, 18 Aug 2020 17:12:49 -0400 Subject: [PATCH] cleanup sdist and bdist build process --- MANIFEST.in | 9 ++-- archivebox.egg-info/SOURCES.txt | 23 +++------ archivebox.egg-info/top_level.txt | 1 - archivebox/LICENSE | 1 + archivebox/README.md | 1 + archivebox/config/__init__.py | 2 +- archivebox/package.json | 1 + bin/release.sh | 4 +- package-lock.json | 2 +- setup.py | 85 ++++++++++++++++--------------- 10 files changed, 61 insertions(+), 68 deletions(-) create mode 120000 archivebox/LICENSE create mode 120000 archivebox/README.md create mode 120000 archivebox/package.json diff --git a/MANIFEST.in b/MANIFEST.in index 2a60c904..c9ae1535 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/archivebox.egg-info/SOURCES.txt b/archivebox.egg-info/SOURCES.txt index 9541d8fc..d186b2fb 100644 --- a/archivebox.egg-info/SOURCES.txt +++ b/archivebox.egg-info/SOURCES.txt @@ -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 \ No newline at end of file +archivebox/themes/legacy/static/spinner.gif \ No newline at end of file diff --git a/archivebox.egg-info/top_level.txt b/archivebox.egg-info/top_level.txt index 9c6a6349..74056b65 100644 --- a/archivebox.egg-info/top_level.txt +++ b/archivebox.egg-info/top_level.txt @@ -1,2 +1 @@ archivebox -tests diff --git a/archivebox/LICENSE b/archivebox/LICENSE new file mode 120000 index 00000000..ea5b6064 --- /dev/null +++ b/archivebox/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/archivebox/README.md b/archivebox/README.md new file mode 120000 index 00000000..32d46ee8 --- /dev/null +++ b/archivebox/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/archivebox/config/__init__.py b/archivebox/config/__init__.py index 04da2632..b1130c34 100644 --- a/archivebox/config/__init__.py +++ b/archivebox/config/__init__.py @@ -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}, diff --git a/archivebox/package.json b/archivebox/package.json new file mode 120000 index 00000000..4e26811d --- /dev/null +++ b/archivebox/package.json @@ -0,0 +1 @@ +../package.json \ No newline at end of file diff --git a/bin/release.sh b/bin/release.sh index 5d9d87d4..16cde4d3 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -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" diff --git a/package-lock.json b/package-lock.json index 88baaf08..f1483913 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "archivebox", - "version": "0.4.18", + "version": "0.4.19", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/setup.py b/setup.py index 10965bfa..db83e9bf 100755 --- a/setup.py +++ b/setup.py @@ -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",