From 80fe9dcb66c84f3020e9106228818a57b5ecd33b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 3 May 2017 15:21:01 +0100 Subject: [PATCH 01/11] ry CSL update on CI --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index f321653..8b27df0 100644 --- a/circle.yml +++ b/circle.yml @@ -19,4 +19,4 @@ test: - flake8 md_pdf/ --ignore=E128,E501 - safety check - bandit -r md_pdf/ - - mdp --help + - mdp --update-csl From 8ce686150c5e50aa0b6ea65ef980fd8e26bb108b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 3 May 2017 15:26:15 +0100 Subject: [PATCH 02/11] try running it instead --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 8b27df0..8a4afba 100644 --- a/circle.yml +++ b/circle.yml @@ -19,4 +19,4 @@ test: - flake8 md_pdf/ --ignore=E128,E501 - safety check - bandit -r md_pdf/ - - mdp --update-csl + - cd test-files/ && mdp -vvv From 4317b5f7184ccc464a1e288bcd027e117216c27e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 3 May 2017 15:32:05 +0100 Subject: [PATCH 03/11] Add artifacts --- circle.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/circle.yml b/circle.yml index 8a4afba..3bcfb2b 100644 --- a/circle.yml +++ b/circle.yml @@ -4,6 +4,9 @@ machine: node: version: 6.10.2 +general: + artifacts: + - test-files/out/ dependencies: pre: From b8e515089f6d2202af10c53eefb819bacbc550da Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 3 May 2017 17:06:35 +0100 Subject: [PATCH 04/11] Remove silent exit --- md_pdf/cli.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/md_pdf/cli.py b/md_pdf/cli.py index d7c7965..ccc136c 100644 --- a/md_pdf/cli.py +++ b/md_pdf/cli.py @@ -19,8 +19,6 @@ def cli(): config = load_config() validate_config(config) build(config) - except PrematureExit: - return 0 except BaseException as e: logging.error(str(e)) return 1 From 44bf3c962fda85d27130d6f76261394942b41e8f Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 3 May 2017 20:53:39 +0100 Subject: [PATCH 05/11] Try update csl --- circle.yml | 1 + md_pdf/csl.py | 1 + 2 files changed, 2 insertions(+) diff --git a/circle.yml b/circle.yml index 3bcfb2b..9ee76d2 100644 --- a/circle.yml +++ b/circle.yml @@ -22,4 +22,5 @@ test: - flake8 md_pdf/ --ignore=E128,E501 - safety check - bandit -r md_pdf/ + - mdp --update-csl - cd test-files/ && mdp -vvv diff --git a/md_pdf/csl.py b/md_pdf/csl.py index 3bf07c6..42ab5e5 100644 --- a/md_pdf/csl.py +++ b/md_pdf/csl.py @@ -26,6 +26,7 @@ def download_csl(): remove_dir(CSL_DIR) def download_handle(count, block_size, total_size): + print(count, block_size, total_size, int(count * block_size * 100 / total_size)) bar.update(int(count * block_size * 100 / total_size)) _, download_location = tempfile.mkstemp() From 9108301772261baa9b4fadb9af212817ce10bea2 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 3 May 2017 21:10:18 +0100 Subject: [PATCH 06/11] Create output dir if needed --- md_pdf/cli.py | 2 +- md_pdf/config/validate.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/md_pdf/cli.py b/md_pdf/cli.py index ccc136c..4b7dec6 100644 --- a/md_pdf/cli.py +++ b/md_pdf/cli.py @@ -1,6 +1,6 @@ import logging from md_pdf.args import parse_args -from md_pdf.exceptions import PrematureExit, BaseException +from md_pdf.exceptions import BaseException from md_pdf.logging import set_verbosity from md_pdf.build import build from md_pdf.config.read import load_config diff --git a/md_pdf/config/validate.py b/md_pdf/config/validate.py index 3a66882..a9d5623 100644 --- a/md_pdf/config/validate.py +++ b/md_pdf/config/validate.py @@ -24,7 +24,8 @@ def check_required_keys(config): def test_output(config): abs_output_dir = os.path.abspath(config['output_dir']) if not os.path.isdir(abs_output_dir): - raise ConfigValidationException("Can't find output directory '{}'".format(abs_output_dir)) + logger.debug("Creating output directory...") + os.mkdir(abs_output_dir) invalid_formats = [key for key in config['output_formats'] if key not in ['html', 'pdf']] if invalid_formats: raise ConfigValidationException("Invalid output formats provided: '{}'".format(", ".join(invalid_formats))) From 88ad1fd6a5a397605d76bb7f8c056144201434dc Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 4 May 2017 08:39:38 +0100 Subject: [PATCH 07/11] Dont update the bar without size --- md_pdf/csl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/md_pdf/csl.py b/md_pdf/csl.py index 42ab5e5..1d45830 100644 --- a/md_pdf/csl.py +++ b/md_pdf/csl.py @@ -26,7 +26,8 @@ def download_csl(): remove_dir(CSL_DIR) def download_handle(count, block_size, total_size): - print(count, block_size, total_size, int(count * block_size * 100 / total_size)) + if total_size < 1: # only update the bar if we have a size + return bar.update(int(count * block_size * 100 / total_size)) _, download_location = tempfile.mkstemp() From 98d15ef0e6485e28fe2361577221bc0300da59f2 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 4 May 2017 08:54:20 +0100 Subject: [PATCH 08/11] Add manifest --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..5aa6a42 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include md_pdf * From daf8a9ab3930c3f285f6c03fb9a886c73aaf4d0e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 4 May 2017 09:10:25 +0100 Subject: [PATCH 09/11] Specify package data --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.py b/setup.py index ec9d32c..4f224e9 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,10 @@ setup( ], packages=find_packages(), include_package_data=True, + zip_safe=False, + package_data={ + '': ['*.js', '*.css', '*.html'] + }, entry_points=""" [console_scripts] mdp=md_pdf.cli:cli From 4827a43faf762a0f7e9c0de80bded1fd04b50b91 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 4 May 2017 09:26:56 +0100 Subject: [PATCH 10/11] Use scm at setup --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 4f224e9..a099a3a 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ from setuptools import setup, find_packages setup( name="md-pdf", version="1.0", + use_scm_version=True, install_requires=[ "beautifulsoup4==4.5.3", "jinja2==2.9.5", @@ -13,12 +14,10 @@ setup( "pyscss==1.3.5", "PyYAML==3.12" ], + setup_requires=['setuptools_scm'], packages=find_packages(), include_package_data=True, zip_safe=False, - package_data={ - '': ['*.js', '*.css', '*.html'] - }, entry_points=""" [console_scripts] mdp=md_pdf.cli:cli From 1cdf2b09197a5965c50543093593f9ab2d06d358 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 4 May 2017 09:31:05 +0100 Subject: [PATCH 11/11] Try removing manifest --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 5aa6a42..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -recursive-include md_pdf *