mirror of
https://github.com/docker/compose.git
synced 2025-07-27 07:34:10 +02:00
Merge pull request #322 from dnephin/fix_cli_for_py26
Fix cli for python 2.6
This commit is contained in:
commit
0dc55fda45
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
*.egg-info
|
*.egg-info
|
||||||
*.pyc
|
*.pyc
|
||||||
|
.tox
|
||||||
/build
|
/build
|
||||||
/dist
|
/dist
|
||||||
/docs/_site
|
/docs/_site
|
||||||
|
@ -24,16 +24,7 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
console_handler = logging.StreamHandler(stream=sys.stderr)
|
setup_logging()
|
||||||
console_handler.setFormatter(logging.Formatter())
|
|
||||||
console_handler.setLevel(logging.INFO)
|
|
||||||
root_logger = logging.getLogger()
|
|
||||||
root_logger.addHandler(console_handler)
|
|
||||||
root_logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
# Disable requests logging
|
|
||||||
logging.getLogger("requests").propagate = False
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command = TopLevelCommand()
|
command = TopLevelCommand()
|
||||||
command.sys_dispatch()
|
command.sys_dispatch()
|
||||||
@ -56,6 +47,18 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def setup_logging():
|
||||||
|
console_handler = logging.StreamHandler(sys.stderr)
|
||||||
|
console_handler.setFormatter(logging.Formatter())
|
||||||
|
console_handler.setLevel(logging.INFO)
|
||||||
|
root_logger = logging.getLogger()
|
||||||
|
root_logger.addHandler(console_handler)
|
||||||
|
root_logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
# Disable requests logging
|
||||||
|
logging.getLogger("requests").propagate = False
|
||||||
|
|
||||||
|
|
||||||
# stolen from docopt master
|
# stolen from docopt master
|
||||||
def parse_doc_section(name, source):
|
def parse_doc_section(name, source):
|
||||||
pattern = re.compile('^([^\n]*' + name + '[^\n]*\n?(?:[ \t].*?(?:\n|$))*)',
|
pattern = re.compile('^([^\n]*' + name + '[^\n]*\n?(?:[ \t].*?(?:\n|$))*)',
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
from .. import unittest
|
from .. import unittest
|
||||||
|
|
||||||
|
from fig.cli import main
|
||||||
from fig.cli.main import TopLevelCommand
|
from fig.cli.main import TopLevelCommand
|
||||||
from fig.packages.six import StringIO
|
from fig.packages.six import StringIO
|
||||||
import os
|
|
||||||
|
|
||||||
class CLITestCase(unittest.TestCase):
|
class CLITestCase(unittest.TestCase):
|
||||||
def test_default_project_name(self):
|
def test_default_project_name(self):
|
||||||
@ -35,3 +39,8 @@ class CLITestCase(unittest.TestCase):
|
|||||||
command = TopLevelCommand()
|
command = TopLevelCommand()
|
||||||
with self.assertRaises(SystemExit):
|
with self.assertRaises(SystemExit):
|
||||||
command.dispatch(['-h'], None)
|
command.dispatch(['-h'], None)
|
||||||
|
|
||||||
|
def test_setup_logging(self):
|
||||||
|
main.setup_logging()
|
||||||
|
self.assertEqual(logging.getLogger().level, logging.DEBUG)
|
||||||
|
self.assertEqual(logging.getLogger('requests').propagate, False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user