diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d92863..84ba1c93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog ========= +### 1.0.4 + +* [Improved] Python 2.6 compatibility + ### 1.0.3 (April 17, 2013) * [Improved] Installs pycrypto by default diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index a6e76c9c..cbe4c3aa 100755 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -87,14 +87,14 @@ def encrypt(journal, filename=None): journal.make_key(prompt="Enter new password:") journal.config['encrypt'] = True journal.write(filename) - print("Journal encrypted to {}.".format(filename or journal.config['journal'])) + print("Journal encrypted to {0}.".format(filename or journal.config['journal'])) def decrypt(journal, filename=None): """ Decrypts into new file. If filename is not set, we encrypt the journal file itself. """ journal.config['encrypt'] = False journal.config['password'] = "" journal.write(filename) - print("Journal decrypted to {}.".format(filename or journal.config['journal'])) + print("Journal decrypted to {0}.".format(filename or journal.config['journal'])) def print_tags(journal): """Prints a list of all tags and the number of occurances.""" @@ -105,20 +105,20 @@ def print_tags(journal): for tag in set(entry.tags) ] # To be read: [for entry in journal.entries: for tag in set(entry.tags): tag] - tag_counts = {(tags.count(tag), tag) for tag in tags} + tag_counts = set([(tags.count(tag), tag) for tag in tags]) if not tag_counts: print('[No tags found in journal.]') elif min(tag_counts)[0] == 0: tag_counts = filter(lambda x: x[0] > 1, tag_counts) print('[Removed tags that appear only once.]') for n, tag in sorted(tag_counts, reverse=False): - print("{:20} : {}".format(tag, n)) + print("{0:20} : {1}".format(tag, n)) def touch_journal(filename): """If filename does not exist, touch the file""" if not os.path.exists(filename): - print("[Journal created at {}]".format(filename)) + print("[Journal created at {0}]".format(filename)) open(filename, 'a').close() def update_config(config, new_config, scope): @@ -185,7 +185,7 @@ def cli(): raw = " ".join(args.text).strip() entry = journal.new_entry(raw, args.date) entry.starred = args.star - print("[Entry added to {} journal]").format(journal_name) + print("[Entry added to {0} journal]").format(journal_name) journal.write() # Reading mode diff --git a/requirements.txt b/requirements.txt index 7b7648ac..a4a16eb3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ parsedatetime >= 1.1.2 colorama >= 0.2.5 pycrypto >= 2.6 +argparse==1.2.1 diff --git a/setup.py b/setup.py index bc94ae85..e9208c11 100644 --- a/setup.py +++ b/setup.py @@ -58,6 +58,11 @@ def get_version(filename="jrnl/__init__.py"): if m: return m.group(1) +conditional_dependencies = { + "pyreadline>=2.0": "win32" in sys.platform, + "argparse==1.2.1": sys.version.startswith("2.6") +} + setup( name = "jrnl", version = get_version(), @@ -67,7 +72,7 @@ setup( "parsedatetime>=1.1.2", "colorama>=0.2.5", "pycrypto>=2.6" - ] + ["pyreadline>=2.0"] if "win" in sys.platform else [], + ] + [p for p, cond in conditional_dependencies.items() if cond], long_description=__doc__, entry_points={ 'console_scripts': [