Пример #1
0
 def argparse(cls, p):
     descrip = 'executables and data files for %s' % (cls.formatname,)
     g = p.add_argument_group(title=cls.__name__, description=descrip)
     g.add_argument('--asciidoc-asciidoc', type=arg_isexecutable,
                    default=which('asciidoc'),
                    help='full path to asciidoc [%(default)s]')
     g.add_argument('--asciidoc-xmllint', type=arg_isexecutable,
                    default=which('xmllint'),
                    help='full path to xmllint [%(default)s]')
Пример #2
0
 def test_fq_executable(self):
     f = ntf(prefix='tldp-which-test', delete=False)
     f.close()
     notfound = which(f.name)
     self.assertIsNone(notfound)
     mode = stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH
     os.chmod(f.name, mode)
     found = which(f.name)
     self.assertEqual(f.name, found)
     os.unlink(f.name)
Пример #3
0
 def test_fq_executable(self):
     f = ntf(prefix='tldp-which-test', delete=False)
     f.close()
     notfound = which(f.name)
     self.assertIsNone(notfound)
     mode = stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH
     os.chmod(f.name, mode)
     found = which(f.name)
     self.assertEqual(f.name, found)
     os.unlink(f.name)
Пример #4
0
 def argparse(cls, p):
     descrip = 'executables and data files for %s' % (cls.formatname, )
     g = p.add_argument_group(title=cls.__name__, description=descrip)
     g.add_argument('--asciidoc-asciidoc',
                    type=arg_isexecutable,
                    default=which('asciidoc'),
                    help='full path to asciidoc [%(default)s]')
     g.add_argument('--asciidoc-xmllint',
                    type=arg_isexecutable,
                    default=which('xmllint'),
                    help='full path to xmllint [%(default)s]')
Пример #5
0
 def argparse(cls, p):
     descrip = 'executables and data files for %s' % (cls.formatname,)
     g = p.add_argument_group(title=cls.__name__, description=descrip)
     g.add_argument('--linuxdoc-sgmlcheck', type=arg_isexecutable,
                    default=which('sgmlcheck'),
                    help='full path to sgmlcheck [%(default)s]')
     g.add_argument('--linuxdoc-sgml2html', type=arg_isexecutable,
                    default=which('sgml2html'),
                    help='full path to sgml2html [%(default)s]')
     g.add_argument('--linuxdoc-html2text', type=arg_isexecutable,
                    default=which('html2text'),
                    help='full path to html2text [%(default)s]')
     g.add_argument('--linuxdoc-htmldoc', type=arg_isexecutable,
                    default=which('htmldoc'),
                    help='full path to htmldoc [%(default)s]')
Пример #6
0
 def test_execute_exception_when_logdir_enoent(self):
     exe = which('true')
     logdir = os.path.join(self.tempdir, 'nonexistent-directory')
     with self.assertRaises(IOError) as ecm:
         execute([exe], logdir=logdir)
     e = ecm.exception
     self.assertTrue('nonexistent' in e.filename)
Пример #7
0
 def test_execute_stdout_to_devnull(self):
     exe = which('cat')
     cmd = [exe, '/etc/hosts']
     devnull = open('/dev/null', 'w')
     result = execute(cmd, stdout=devnull, logdir=self.tempdir)
     devnull.close()
     self.assertEqual(0, result)
Пример #8
0
 def test_execute_exception_when_logdir_enoent(self):
     exe = which('true')
     logdir = os.path.join(self.tempdir, 'nonexistent-directory')
     with self.assertRaises(IOError) as ecm:
         execute([exe], logdir=logdir)
     e = ecm.exception
     self.assertTrue('nonexistent' in e.filename)
Пример #9
0
 def test_execute_stderr_to_devnull(self):
     exe = which('cat')
     cmd = [exe, '/etc/hosts']
     devnull = open('/dev/null', 'w')
     result = execute(cmd, stderr=devnull, logdir=self.tempdir)
     devnull.close()
     self.assertEqual(0, result)
Пример #10
0
    def argparse(cls, p):
        descrip = 'executables for %s' % (cls.formatname,)
        g = p.add_argument_group(title=cls.__name__, description=descrip)
        gadd = g.add_argument
        gadd('--docbook5xml-xslchunk', type=arg_isreadablefile,
             default=xslchunk_finder(),
             help='full path to LDP HTML chunker XSL [%(default)s]')
        gadd('--docbook5xml-xslsingle', type=arg_isreadablefile,
             default=xslsingle_finder(),
             help='full path to LDP HTML single-page XSL [%(default)s]')
        gadd('--docbook5xml-xslprint', type=arg_isreadablefile,
             default=xslprint_finder(),
             help='full path to LDP FO print XSL [%(default)s]')

        gadd('--docbook5xml-rngfile', type=arg_isreadablefile,
             default=rngfile_finder(),
             help='full path to docbook.rng [%(default)s]')
        gadd('--docbook5xml-xmllint', type=arg_isexecutable,
             default=which('xmllint'),
             help='full path to xmllint [%(default)s]')
        gadd('--docbook5xml-xsltproc', type=arg_isexecutable,
             default=which('xsltproc'),
             help='full path to xsltproc [%(default)s]')
        gadd('--docbook5xml-html2text', type=arg_isexecutable,
             default=which('html2text'),
             help='full path to html2text [%(default)s]')
        gadd('--docbook5xml-fop', type=arg_isexecutable,
             default=which('fop'),
             help='full path to fop [%(default)s]')
        gadd('--docbook5xml-dblatex', type=arg_isexecutable,
             default=which('dblatex'),
             help='full path to dblatex [%(default)s]')
        gadd('--docbook5xml-jing', type=arg_isexecutable,
             default=which('jing'),
             help='full path to jing [%(default)s]')
Пример #11
0
 def argparse(cls, p):
     descrip = 'executables and data files for %s' % (cls.formatname, )
     g = p.add_argument_group(title=cls.__name__, description=descrip)
     gadd = g.add_argument
     gadd('--docbook4xml-xslchunk',
          type=arg_isreadablefile,
          default=xslchunk_finder(),
          help='full path to LDP HTML chunker XSL [%(default)s]')
     gadd('--docbook4xml-xslsingle',
          type=arg_isreadablefile,
          default=xslsingle_finder(),
          help='full path to LDP HTML single-page XSL [%(default)s]')
     gadd('--docbook4xml-xslprint',
          type=arg_isstr,
          default=xslprint_finder(),
          help='full path to LDP FO print XSL [%(default)s]')
     gadd('--docbook4xml-xmllint',
          type=arg_isexecutable,
          default=which('xmllint'),
          help='full path to xmllint [%(default)s]')
     gadd('--docbook4xml-xsltproc',
          type=arg_isexecutable,
          default=which('xsltproc'),
          help='full path to xsltproc [%(default)s]')
     gadd('--docbook4xml-html2text',
          type=arg_isexecutable,
          default=which('html2text'),
          help='full path to html2text [%(default)s]')
     gadd('--docbook4xml-fop',
          type=arg_isexecutable,
          default=which('fop'),
          help='full path to fop [%(default)s]')
     gadd('--docbook4xml-dblatex',
          type=arg_isexecutable,
          default=which('dblatex'),
          help='full path to dblatex [%(default)s]')
Пример #12
0
 def argparse(cls, p):
     descrip = 'executables and data files for %s' % (cls.formatname,)
     g = p.add_argument_group(title=cls.__name__, description=descrip)
     g.add_argument('--docbooksgml-docbookdsl', type=arg_isreadablefile,
                    default=docbookdsl_finder(),
                    help='full path to html/docbook.dsl [%(default)s]')
     g.add_argument('--docbooksgml-ldpdsl', type=arg_isreadablefile,
                    default=ldpdsl_finder(),
                    help='full path to ldp/ldp.dsl [%(default)s]')
     g.add_argument('--docbooksgml-jw', type=arg_isexecutable,
                    default=which('jw'),
                    help='full path to jw [%(default)s]')
     g.add_argument('--docbooksgml-html2text', type=arg_isexecutable,
                    default=which('html2text'),
                    help='full path to html2text [%(default)s]')
     g.add_argument('--docbooksgml-openjade', type=arg_isexecutable,
                    default=which('openjade'),
                    help='full path to openjade [%(default)s]')
     g.add_argument('--docbooksgml-dblatex', type=arg_isexecutable,
                    default=which('dblatex'),
                    help='full path to dblatex [%(default)s]')
     g.add_argument('--docbooksgml-collateindex', type=arg_isexecutable,
                    default=which('collateindex.pl'),
                    help='full path to collateindex [%(default)s]')
Пример #13
0
 def test_execute_exception_when_logdir_none(self):
     exe = which('true')
     with self.assertRaises(ValueError) as ecm:
         execute([exe], logdir=None)
     e = ecm.exception
     self.assertTrue('logdir must be a directory' in e.args[0])
Пример #14
0
 def test_execute_returns_nonzero(self):
     exe = which('false')
     result = execute([exe], logdir=self.tempdir)
     self.assertEqual(1, result)
Пример #15
0
 def test_execute_exception_when_logdir_none(self):
     exe = which('true')
     with self.assertRaises(ValueError) as ecm:
         execute([exe], logdir=None)
     e = ecm.exception
     self.assertTrue('logdir must be a directory' in e.args[0])
Пример #16
0
 def test_execute_returns_zero(self):
     exe = which('true')
     result = execute([exe], logdir=self.tempdir)
     self.assertEqual(0, result)
Пример #17
0
 def test_good_which_python(self):
     python = which('python')
     self.assertIsNotNone(python)
     self.assertTrue(os.path.isfile(python))
     qualified_python = which(python)
     self.assertEqual(python, qualified_python)
Пример #18
0
 def test_bad_silly_name(self):
     silly = which('silliest-executable-name-which-may-yet-be-possible')
     self.assertIsNone(silly)
Пример #19
0
 def test_bad_silly_name(self):
     silly = which('silliest-executable-name-which-may-yet-be-possible')
     self.assertIsNone(silly)
Пример #20
0
 def test_good_which_python(self):
     python = which('python')
     self.assertIsNotNone(python)
     self.assertTrue(os.path.isfile(python))
     qualified_python = which(python)
     self.assertEqual(python, qualified_python)
Пример #21
0
 def test_execute_returns_zero(self):
     exe = which('true')
     result = execute([exe], logdir=self.tempdir)
     self.assertEqual(0, result)
Пример #22
0
 def test_execute_returns_nonzero(self):
     exe = which('false')
     result = execute([exe], logdir=self.tempdir)
     self.assertEqual(1, result)