comparison planemo/lib/python3.7/site-packages/virtualenv/app_data/base.py @ 1:56ad4e20f292 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:32:28 -0400
parents
children
comparison
equal deleted inserted replaced
0:d30785e31577 1:56ad4e20f292
1 """
2 Application data stored by virtualenv.
3 """
4 from __future__ import absolute_import, unicode_literals
5
6 from abc import ABCMeta, abstractmethod
7 from contextlib import contextmanager
8
9 import six
10
11 from virtualenv.info import IS_ZIPAPP
12
13
14 @six.add_metaclass(ABCMeta)
15 class AppData(object):
16 """Abstract storage interface for the virtualenv application"""
17
18 @abstractmethod
19 def close(self):
20 """called before virtualenv exits"""
21
22 @abstractmethod
23 def reset(self):
24 """called when the user passes in the reset app data"""
25
26 @abstractmethod
27 def py_info(self, path):
28 raise NotImplementedError
29
30 @abstractmethod
31 def py_info_clear(self):
32 raise NotImplementedError
33
34 @abstractmethod
35 def embed_update_log(self, distribution, for_py_version):
36 raise NotImplementedError
37
38 @property
39 def house(self):
40 raise NotImplementedError
41
42 @property
43 def transient(self):
44 raise NotImplementedError
45
46 @abstractmethod
47 def wheel_image(self, for_py_version, name):
48 raise NotImplementedError
49
50 @contextmanager
51 def ensure_extracted(self, path, to_folder=None):
52 """Some paths might be within the zipapp, unzip these to a path on the disk"""
53 if IS_ZIPAPP:
54 with self.extract(path, to_folder) as result:
55 yield result
56 else:
57 yield path
58
59 @abstractmethod
60 @contextmanager
61 def extract(self, path, to_folder):
62 raise NotImplementedError
63
64 @abstractmethod
65 @contextmanager
66 def locked(self, path):
67 raise NotImplementedError
68
69
70 @six.add_metaclass(ABCMeta)
71 class ContentStore(object):
72 @abstractmethod
73 def exists(self):
74 raise NotImplementedError
75
76 @abstractmethod
77 def read(self):
78 raise NotImplementedError
79
80 @abstractmethod
81 def write(self, content):
82 raise NotImplementedError
83
84 @abstractmethod
85 def remove(self):
86 raise NotImplementedError
87
88 @abstractmethod
89 @contextmanager
90 def locked(self):
91 pass