From da62fcfa00afdbb45d8d6fb962eba02d6cd8c0f1 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Mon, 28 Nov 2016 19:52:53 +0000 Subject: [PATCH] adding template files on install --- aiohttp_devtools/start/main.py | 3 ++- .../start/template/requirements.txt | 2 +- setup.py | 22 +++++++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/aiohttp_devtools/start/main.py b/aiohttp_devtools/start/main.py index e1215a5f..286f4b7a 100644 --- a/aiohttp_devtools/start/main.py +++ b/aiohttp_devtools/start/main.py @@ -98,7 +98,8 @@ def generate_directory(self, p: Path): self.generate_directory(pp) else: assert pp.is_file() - self.generate_file(pp) + if not pp.name.endswith('.pyc'): + self.generate_file(pp) def generate_file(self, p: Path): try: diff --git a/aiohttp_devtools/start/template/requirements.txt b/aiohttp_devtools/start/template/requirements.txt index 29e8afaa..7f9552dd 100644 --- a/aiohttp_devtools/start/template/requirements.txt +++ b/aiohttp_devtools/start/template/requirements.txt @@ -1,6 +1,6 @@ {# This file is special: lines are made unique, stripped and sorted before the new requirements.txt file is created #} -aiohttp==1.1.1 +aiohttp==1.1.6 trafaret-config==0.1.1 {% if template_engine.is_jinja2 %} diff --git a/setup.py b/setup.py index 218387a7..895c465b 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,10 @@ +import os from importlib.machinery import SourceFileLoader from pathlib import Path from setuptools import setup -long_description = Path(__file__).resolve().parent.joinpath('README.rst').read_text() +THIS_DIR = Path(__file__).resolve().parent +long_description = THIS_DIR.joinpath('README.rst').read_text() # avoid loading the package before requirements are installed: version = SourceFileLoader('version', 'aiohttp_devtools/version.py').load_module() @@ -10,11 +12,10 @@ def check_livereload_js(): import hashlib - from pathlib import Path live_reload_221_hash = 'a451e4d39b8d7ef62d380d07742b782f' live_reload_221_url = 'https://raw.githubusercontent.com/livereload/livereload-js/v2.2.1/dist/livereload.js' - path = Path(__file__).absolute().parent.joinpath('aiohttp_devtools/runserver/livereload.js') + path = THIS_DIR.joinpath('aiohttp_devtools/runserver/livereload.js') def check_path(): with path.open('rb') as fr: @@ -37,6 +38,16 @@ def check_path(): check_livereload_js() +package = THIS_DIR.joinpath('aiohttp_devtools/start') + +start_package_data = [] + +for _root, _, files in os.walk(str(THIS_DIR.joinpath('aiohttp_devtools/start/template'))): + root = Path(_root) + for f in files: + p = root / f + start_package_data.append(str(p.relative_to(package))) + setup( name='aiohttp-devtools', version=str(version.VERSION), @@ -61,7 +72,10 @@ def check_path(): author_email='s@muelcolvin.com', url='https://github.com/samuelcolvin/aiohttp-devtools', license='MIT', - package_data={'aiohttp_devtools.runserver': ['livereload.js']}, + package_data={ + 'aiohttp_devtools.runserver': ['livereload.js'], + 'aiohttp_devtools.start': start_package_data, + }, packages=[ 'aiohttp_devtools', 'aiohttp_devtools.runserver',