Mercurial > hg
comparison mercurial/policy.py @ 51957:f3bef5eb12f9 stable
module-policy: ignore empty module policy
This make the variable easier to work with, the empty value is not ambiguous
about not wanting to get in the way.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 08 Oct 2024 15:54:59 +0200 |
parents | 18c8c18993f0 |
children | 5e2f0fec0a47 |
comparison
equal
deleted
inserted
replaced
51916:7ff35f1290c0 | 51957:f3bef5eb12f9 |
---|---|
49 # But we don't import platform and don't bloat for it here. | 49 # But we don't import platform and don't bloat for it here. |
50 if '__pypy__' in sys.builtin_module_names: | 50 if '__pypy__' in sys.builtin_module_names: |
51 policy = b'cffi' | 51 policy = b'cffi' |
52 | 52 |
53 # Environment variable can always force settings. | 53 # Environment variable can always force settings. |
54 if 'HGMODULEPOLICY' in os.environ: | 54 if os.environ.get('HGMODULEPOLICY'): # ignore None and Empty |
55 policy = os.environ['HGMODULEPOLICY'].encode('utf-8') | 55 policy = os.environ['HGMODULEPOLICY'].encode('utf-8') |
56 | 56 |
57 | 57 |
58 def _importfrom(pkgname, modname): | 58 def _importfrom(pkgname, modname): |
59 # from .<pkgname> import <modname> (where . is looked through this module) | 59 # from .<pkgname> import <modname> (where . is looked through this module) |