mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
rough plugin system implementation
This commit is contained in:
parent
32f09603e1
commit
bf815251ec
3 changed files with 84 additions and 10 deletions
|
@ -16,6 +16,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
class TmpCwd():
|
||||
|
@ -32,3 +33,18 @@ class TmpCwd():
|
|||
|
||||
def __exit__(self, a, b, c):
|
||||
os.chdir(self.orig_cwd)
|
||||
|
||||
|
||||
class TmpPyPath():
|
||||
"""Context-manager for temporarily changing the current working
|
||||
directory.
|
||||
"""
|
||||
|
||||
def __init__(self, additional_path):
|
||||
self.additional_path = additional_path
|
||||
|
||||
def __enter__(self):
|
||||
sys.path.append(self.additional_path)
|
||||
|
||||
def __exit__(self, a, b, c):
|
||||
sys.path.remove(self.additional_path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue