diff --git a/over/file.py b/over/file.py index fc2b2cc..6978299 100644 --- a/over/file.py +++ b/over/file.py @@ -1,6 +1,7 @@ #! /usr/bin/env python3 # encoding: utf-8 +from contextlib import contextmanager import os # -------------------------------------------------- @@ -37,3 +38,18 @@ def count_lines(path): lines += buffer.count(b"\n") return lines + +# -------------------------------------------------- + +@contextmanager +def context_dir(path): + """ + A directory context manager. + """ + previous = os.getcwd() + os.chdir(path) + + try: + yield + finally: + os.chdir(previous) diff --git a/over/version.py b/over/version.py index cf156d4..70f0af0 100644 --- a/over/version.py +++ b/over/version.py @@ -2,7 +2,7 @@ # encoding: utf-8 major = 1 # VERSION_MAJOR_IDENTIFIER -minor = 100 # VERSION_MINOR_IDENTIFIER -# VERSION_LAST_MM 1.100 +minor = 101 # VERSION_MINOR_IDENTIFIER +# VERSION_LAST_MM 1.101 patch = 0 # VERSION_PATCH_IDENTIFIER -str = "1.100.0" # VERSION_STRING_IDENTIFIER +str = "1.101.0" # VERSION_STRING_IDENTIFIER