From 214daddba47f4ef8450ab74c63718d1983de6c18 Mon Sep 17 00:00:00 2001 From: Justin Quick Date: Sun, 5 Dec 2021 01:58:57 -0500 Subject: [PATCH] makedirs, easier packaging in setup.py --- pdf12step/templating.py | 5 ++++- pyproject.toml | 41 ----------------------------------------- setup.py | 2 +- tox.ini | 18 ++++++++++++++++++ 4 files changed, 23 insertions(+), 43 deletions(-) delete mode 100644 pyproject.toml create mode 100644 tox.ini diff --git a/pdf12step/templating.py b/pdf12step/templating.py index 69a402f..9d57dae 100644 --- a/pdf12step/templating.py +++ b/pdf12step/templating.py @@ -1,5 +1,5 @@ import re -from os import path +from os import path, makedirs from datetime import datetime from collections import defaultdict from functools import reduce @@ -181,6 +181,9 @@ def prerender(self): Prerenders the assets ahead of page render to ensure proper values in assets are set """ for template, dest in ASSET_TEMPLATES.items(): + dest_dir = path.dirname(dest) + if not path.isdir(dest_dir): + makedirs(dest_dir) with open(dest, 'w') as destfile: destfile.write(self.render(template)) diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index b9ef9e1..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,41 +0,0 @@ -[tool.poetry] -name = "pdf12step" -version = "1.0.0" -description = "Generates PDFs meeting guides from sites using the 12 Step Meeting List WordPress plugin" -authors = ["Justin Quick "] -license = "BSD" - -[tool.poetry.dependencies] -python = "^3.7" - -[tool.poetry.dev-dependencies] - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" - -[tool.tox] -legacy_tox_ini = """ -[tox] -envlist = py37 - -[testenv] -deps = - requests==2.26.0 - Flask==2.0.2 - Flask-WeasyPrint==0.6 - weasyprint==53.4 - attrdict==2.0.1 - PyYAML==6.0 - - pytest==6.2.5 - pytest-cov==3.0.0 - ipython - -commands = - python -m pytest - -[gh-actions] -python = - 3.7: py37 -""" diff --git a/setup.py b/setup.py index 807f45e..958baa9 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ }, classifiers=[ 'Development Status :: 4 - Beta', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Framework :: Flask', diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..bef2e90 --- /dev/null +++ b/tox.ini @@ -0,0 +1,18 @@ + +[tox] +envlist = py36,py37,py38 + +[testenv] +deps = + requests + Flask + Flask-WeasyPrint + weasyprint + attrdict + PyYAML + + pytest + ipython + +commands = + pytest --pdb --pdbcls=IPython.terminal.debugger:TerminalPdb -s