Merge branch 'develop' into markdown-newline-end

This commit is contained in:
Jonathan Wren 2020-04-11 12:29:30 -07:00 committed by GitHub
commit 9c849f75f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 8 deletions

View file

@ -8,6 +8,11 @@
- Merge in temp branches for v2.4 [\#897](https://github.com/jrnl-org/jrnl/pull/897) ([wren](https://github.com/wren)) - Merge in temp branches for v2.4 [\#897](https://github.com/jrnl-org/jrnl/pull/897) ([wren](https://github.com/wren))
**Fixed bugs:**
- Fix Python 3.9 incompatibility by updating plistlib [\#909](https://github.com/jrnl-org/jrnl/pull/909) ([MinchinWeb](https://github.com/MinchinWeb))
- Fix typo in YAML exporter \("stared" -\> "starred"\) [\#907](https://github.com/jrnl-org/jrnl/pull/907) ([MinchinWeb](https://github.com/MinchinWeb))
**Build:** **Build:**
- Update Poetry requirements for testing latest Python version [\#898](https://github.com/jrnl-org/jrnl/pull/898) ([wren](https://github.com/wren)) - Update Poetry requirements for testing latest Python version [\#898](https://github.com/jrnl-org/jrnl/pull/898) ([wren](https://github.com/wren))

View file

@ -129,7 +129,7 @@ Feature: Exporting a Journal
""" """
title: I have an @idea: title: I have an @idea:
date: 2013-04-09 15:39 date: 2013-04-09 15:39
stared: False starred: False
tags: idea, journal tags: idea, journal
(1) write a command line @journal software (1) write a command line @journal software

View file

@ -159,3 +159,10 @@ Feature: Zapped bugs should stay dead.
tags: tags:
""" """
@deployment_tests
Scenario: Version numbers should stay in sync
Given we use the config "basic.yaml"
When we run "jrnl --version"
Then we should get no error
Then the output should contain pyproject.toml version

View file

@ -19,6 +19,8 @@ import keyring
import tzlocal import tzlocal
import shlex import shlex
import sys import sys
from pathlib import Path
import toml
consts = pdt.Constants(usePyICU=False) consts = pdt.Constants(usePyICU=False)
consts.DOWParseStyle = -1 # Prefers past weekdays consts.DOWParseStyle = -1 # Prefers past weekdays
@ -207,6 +209,15 @@ def check_output_time_inline(context, text):
assert output_date in out, output_date assert output_date in out, output_date
@then("the output should contain pyproject.toml version")
def check_output_version_inline(context):
out = context.stdout_capture.getvalue()
pyproject = (Path(__file__) / ".." / ".." / ".." / "pyproject.toml").resolve()
pyproject_contents = toml.load(pyproject)
pyproject_version = pyproject_contents["tool"]["poetry"]["version"]
assert pyproject_version in out, pyproject_version
@then("the output should contain") @then("the output should contain")
@then('the output should contain "{text}"') @then('the output should contain "{text}"')
@then('the output should contain "{text}" or "{text2}"') @then('the output should contain "{text}" or "{text2}"')

View file

@ -8,6 +8,7 @@ import re
from datetime import datetime from datetime import datetime
import time import time
import fnmatch import fnmatch
from pathlib import Path
import plistlib import plistlib
import pytz import pytz
import uuid import uuid
@ -43,7 +44,7 @@ class DayOne(Journal.Journal):
for filename in filenames: for filename in filenames:
with open(filename, "rb") as plist_entry: with open(filename, "rb") as plist_entry:
try: try:
dict_entry = plistlib.readPlist(plist_entry) dict_entry = plistlib.load(plist_entry, fmt=plistlib.FMT_XML)
except self.PLIST_EXCEPTIONS: except self.PLIST_EXCEPTIONS:
pass pass
else: else:
@ -84,8 +85,10 @@ class DayOne(Journal.Journal):
if not hasattr(entry, "uuid"): if not hasattr(entry, "uuid"):
entry.uuid = uuid.uuid1().hex entry.uuid = uuid.uuid1().hex
filename = os.path.join( fn = (
self.config["journal"], "entries", entry.uuid.upper() + ".doentry" Path(self.config["journal"])
/ "entries"
/ (entry.uuid.upper() + ".doentry")
) )
entry_plist = { entry_plist = {
@ -99,7 +102,9 @@ class DayOne(Journal.Journal):
for tag in entry.tags for tag in entry.tags
], ],
} }
plistlib.writePlist(entry_plist, filename) # plistlib expects a binary object
with fn.open(mode="wb") as f:
plistlib.dump(entry_plist, f, fmt=plistlib.FMT_XML, sort_keys=False)
for entry in self._deleted_entries: for entry in self._deleted_entries:
filename = os.path.join( filename = os.path.join(
self.config["journal"], "entries", entry.uuid + ".doentry" self.config["journal"], "entries", entry.uuid + ".doentry"

View file

@ -108,10 +108,10 @@ class YAMLExporter(TextExporter):
# source directory is entry.journal.config['journal'] # source directory is entry.journal.config['journal']
# output directory is...? # output directory is...?
return "title: {title}\ndate: {date}\nstared: {stared}\ntags: {tags}\n{dayone} {body} {space}".format( return "title: {title}\ndate: {date}\nstarred: {starred}\ntags: {tags}\n{dayone} {body} {space}".format(
date=date_str, date=date_str,
title=entry.title, title=entry.title,
stared=entry.starred, starred=entry.starred,
tags=", ".join([tag[1:] for tag in entry.tags]), tags=", ".join([tag[1:] for tag in entry.tags]),
dayone=dayone_attributes, dayone=dayone_attributes,
body=newbody, body=newbody,

2
poetry.lock generated
View file

@ -522,7 +522,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
testing = ["jaraco.itertools", "func-timeout"] testing = ["jaraco.itertools", "func-timeout"]
[metadata] [metadata]
content-hash = "17cf8d4cf5a772217160daf312f590901dea4a3f5545d003035f3fb713a70f07" content-hash = "afeb906a1ba51bc9fc4e8c19c0b2c63bb5c9529697c9496d6edb64b509da9e0f"
python-versions = ">=3.6.0, <3.9.0" python-versions = ">=3.6.0, <3.9.0"
[metadata.files] [metadata.files]

View file

@ -35,6 +35,7 @@ behave = "^1.2"
mkdocs = "^1.0" mkdocs = "^1.0"
flake8 = "^3.7" flake8 = "^3.7"
black = {version = "^19.10b0",allow-prereleases = true} black = {version = "^19.10b0",allow-prereleases = true}
toml = "^0.10.0"
[tool.poetry.scripts] [tool.poetry.scripts]
jrnl = 'jrnl.cli:run' jrnl = 'jrnl.cli:run'