140
140
% (self._module, self._name))
141
141
use_msg = ' Use %s.%s instead.' % (self._replacement_module,
142
142
self._replacement_name)
143
symbol_versioning.warn(depr_msg + use_msg, DeprecationWarning,
143
symbol_versioning.warn(depr_msg + use_msg, DeprecationWarning)
145
144
# Import the new feature and use it as a replacement for the
146
145
# deprecated one.
147
146
self._feature = pyutils.get_named_object(
166
165
self.module_name = module_name
168
167
def _probe(self):
170
module = sys.modules.get(self.module_name, sentinel)
171
if module is sentinel:
173
self._module = __import__(self.module_name, {}, {}, [''])
178
self._module = module
169
self._module = __import__(self.module_name, {}, {}, [''])
182
175
def module(self):
290
283
if CaseInsCasePresFilenameFeature.available():
293
from bzrlib import tests
295
286
if tests.TestCaseWithMemoryTransport.TEST_ROOT is None:
296
287
root = osutils.mkdtemp(prefix='testbzr-', suffix='.tmp')
297
288
tests.TestCaseWithMemoryTransport.TEST_ROOT = root
348
339
apport = ModuleAvailableFeature('apport')
349
340
gpgme = ModuleAvailableFeature('gpgme')
350
341
lzma = ModuleAvailableFeature('lzma')
351
meliae = ModuleAvailableFeature('meliae.scanner')
342
meliae = ModuleAvailableFeature('meliae')
352
343
paramiko = ModuleAvailableFeature('paramiko')
353
344
pycurl = ModuleAvailableFeature('pycurl')
354
345
pywintypes = ModuleAvailableFeature('pywintypes')
411
403
bash_feature = ExecutableFeature('bash')
404
sed_feature = ExecutableFeature('sed')
412
405
diff_feature = ExecutableFeature('diff')
413
sed_feature = ExecutableFeature('sed')
414
msgmerge_feature = ExecutableFeature('msgmerge')
417
408
class _PosixPermissionsFeature(Feature):
424
415
f = tempfile.mkstemp(prefix='bzr_perms_chk_')
427
osutils.chmod_if_possible(name, write_perms)
418
os.chmod(name, write_perms)
429
420
read_perms = os.stat(name).st_mode & 0777
495
486
win32_feature = Win32Feature()
489
for name in ['HTTPServerFeature',
490
'HTTPSServerFeature', 'SymlinkFeature', 'HardlinkFeature',
491
'OsFifoFeature', 'UnicodeFilenameFeature',
492
'ByteStringNamedFilesystem', 'UTF8Filesystem',
493
'BreakinFeature', 'CaseInsCasePresFilenameFeature',
494
'CaseInsensitiveFilesystemFeature', 'case_sensitive_filesystem_feature',
495
'posix_permissions_feature',
497
setattr(tests, name, _CompatabilityThunkFeature(
498
symbol_versioning.deprecated_in((2, 5, 0)),
499
'bzrlib.tests', name,
500
name, 'bzrlib.tests.features'))
503
for (old_name, new_name) in [
504
('UnicodeFilename', 'UnicodeFilenameFeature'),
506
setattr(tests, name, _CompatabilityThunkFeature(
507
symbol_versioning.deprecated_in((2, 5, 0)),
508
'bzrlib.tests', old_name,
509
new_name, 'bzrlib.tests.features'))