diff --git a/.gitignore b/.gitignore index 465c10a..de6186c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,7 @@ docs/build/ .pytest_cache/ .venv/ + +dist/ + +*egg-info/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f6d2b06 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "pyassetman" +description = "assetman assetmanager" +version = "0.3.0rc1" +authors = [ + { name="Will McCutchen", email="wm@bit.ly" }, +] +maintainers = [ + { name="Jehiah Czebotar", email="jehiah@gmail.com"}, + { name="Josh Harshman", email="josh.harshman@bit.ly"} +] +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", +] +dependencies = [ + "boto3>=1.10.0", + "tornado>=5.1.1", +] + +[tool.setuptools] +packages = ["assetman", "assetman.parsers", "assetman.tornadoutils"] + diff --git a/scripts/assetman_compile b/scripts/assetman_compile deleted file mode 100755 index 8042cb6..0000000 --- a/scripts/assetman_compile +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -python -m assetman.compile $* diff --git a/scripts/invalidate_cloudfront_assets.py b/scripts/invalidate_cloudfront_assets.py deleted file mode 100755 index 64f0df2..0000000 --- a/scripts/invalidate_cloudfront_assets.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/env python2.7 - -import os -import sys - -# Find our project root, assuming this file lives in ./scripts/. We add that -# root dir to sys.path and use it as our working directory. -project_root = os.path.realpath( - os.path.join(os.path.dirname(__file__), '..')) -if project_root not in sys.path: - sys.path.insert(0, project_root) - -import tornado.options -from boto.cloudfront import CloudFrontConnection -import settings - -tornado.options.define('url', type=str, multiple=True, help='A URL to invalidate (may be full URL or just path fragment)') - -def invalidate_paths(paths): - cx = CloudFrontConnection( - settings.get('aws_access_key'), settings.get('aws_secret_key')) - distros = cx.get_all_distributions() - return [cx.create_invalidation_request(d.id, paths) for d in distros] - -def main(urls): - if not urls: - choice = input('No URLs given. Invalidate all URLs? (y/n) ') - if choice.lower() != 'y': - return 1 - urls = ['/*'] - paths = ['/' + url.rsplit('/')[-1] for url in urls] - reqs = invalidate_paths(paths) - if urls == ['/*']: - what = 'all URLs' - else: - what = '%d URLs' % len(urls) - print('May or may not have invalidated cache for %s on %s CloudFront distributions' % (what, len(reqs))) - return 0 - - -if __name__ == '__main__': - tornado.options.parse_command_line() - sys.exit(main(tornado.options.options.url or [])) \ No newline at end of file diff --git a/scripts/watch_handlebars.js b/scripts/watch_handlebars.js deleted file mode 100644 index e9bba7f..0000000 --- a/scripts/watch_handlebars.js +++ /dev/null @@ -1,30 +0,0 @@ -var Handlebars = require('handlebars') -var watcher = require('watch-tree') -var path = require('path') -var fs = require('fs') -var exec = require('child_process').exec -var jsDir = path.join(__dirname, '..', 'static/js') -var templates = path.join(__dirname, '..', 'static/templates') - - -var recompile = function recompile(file) { - if (path.extname(file) !== '.handlebars') - return; - console.log('change: ', file) - exec('handlebars --output ' + jsDir + '/templates.js ' + templates + '/{,**/}*.handlebars', function(err, stdout, stderr) { - if (err) { - console.error(err); - } - else { - console.log('compiled all templates') - } - }) -} - -// Initialize watchTree utility -var watch = watcher.watchTree(templates); - -watch.on('fileModified', recompile); -watch.on('fileCreated', recompile); -watch.on('fileDeleted', recompile); -console.log('Watching for changes in Handlebars Templates...') diff --git a/setup.py b/setup.py deleted file mode 100755 index bf43cc0..0000000 --- a/setup.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/python - -from distutils.core import setup - -setup(name='assetman', - version='0.2.0', # also update in __init__.py - description='AssetMan asset manager', - url="http://github.com/bitly/assetman", - license="Apache Software License", - author='Will McCutchen', - author_email="wm@bit.ly", - maintainer="Jehiah Czebotar", - maintainer_email="jehiah@gmail.com", - packages=['assetman', 'assetman/parsers', 'assetman/tornadoutils'], - classifiers = [ - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - ], - scripts=['scripts/assetman_compile'] -)