Mercurial > hg
comparison mercurial/crecord.py @ 24423:01b39e821d00
crecord: conditionalize the imports that are not available on Windows
'fcntl', 'termios' and 'wcurses' are not available on the default Windows python
installation, and importing them caused widespread carnage in the test suite.
There were 29 different changed test files (on top of unrelated errors), mostly
in the form of an ImportError.
The failures weren't related to actual crecord use, and followed the import
chain:
'localrepo' -> 'subrepo' -> 'cmdutil' -> 'crecord' -> 'fcntl'
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 20 Mar 2015 23:32:00 -0400 |
parents | cdc4f3af2497 |
children | 3a4122bb9488 |
comparison
equal
deleted
inserted
replaced
24422:2bdd35ea0a03 | 24423:01b39e821d00 |
---|---|
10 | 10 |
11 from i18n import _ | 11 from i18n import _ |
12 import patch as patchmod | 12 import patch as patchmod |
13 import util, encoding | 13 import util, encoding |
14 | 14 |
15 import os, re, sys, fcntl, struct, termios, signal, tempfile, locale, cStringIO | 15 import os, re, sys, struct, signal, tempfile, locale, cStringIO |
16 | 16 |
17 # This is required for ncurses to display non-ASCII characters in default user | 17 # This is required for ncurses to display non-ASCII characters in default user |
18 # locale encoding correctly. --immerrr | 18 # locale encoding correctly. --immerrr |
19 locale.setlocale(locale.LC_ALL, '') | 19 locale.setlocale(locale.LC_ALL, '') |
20 | 20 |
21 # os.name is one of: 'posix', 'nt', 'dos', 'os2', 'mac', or 'ce' | 21 # os.name is one of: 'posix', 'nt', 'dos', 'os2', 'mac', or 'ce' |
22 if os.name == 'posix': | 22 if os.name == 'posix': |
23 import curses | 23 import curses, fcntl, termios |
24 else: | 24 else: |
25 # I have no idea if wcurses works with crecord... | 25 # I have no idea if wcurses works with crecord... |
26 import wcurses as curses | 26 try: |
27 import wcurses as curses | |
28 except ImportError: | |
29 # wcurses is not shipped on Windows by default | |
30 pass | |
27 | 31 |
28 try: | 32 try: |
29 curses | 33 curses |
30 except NameError: | 34 except NameError: |
31 raise util.Abort( | 35 raise util.Abort( |