Beispiel #1
0
 def run(self):
     self.run_command('build')
     build_lib = self.get_finalized_command('build').build_lib
     old_pythonpath = None
     try:
         if 'PYTHONPATH' in os.environ:
             old_pythonpath = os.environ['PYTHONPATH']
             os.environ['PYTHONPATH'] = build_lib + ':' + old_pythonpath
         else:
             os.environ['PYTHONPATH'] = build_lib
         python_exec = os.path.normpath(sys.executable)
         log.info("running other tests...")
         errors = False
         for test_mod in self.distribution.netsa_other_test_modules:
             try:
                 cmd = command(python_exec, "-m", test_mod,
                               self.distribution.source_dir)
                 log.debug("PYTHONPATH=%s %s",
                           os.environ['PYTHONPATH'], cmd)
                 run_parallel([cmd], stdout=sys.stdout, stderr=sys.stderr)
             except:
                 errors = True
         if errors:
             log.info("running other tests... failed")
             sys.exit(-1)
         log.info("running other tests... success")
     finally:
         if old_pythonpath:
             os.environ['PYTHONPATH'] = old_pythonpath
         else:
             del os.environ['PYTHONPATH']
Beispiel #2
0
 def run(self):
     self.run_command('build')
     build_lib = self.get_finalized_command('build').build_lib
     old_pythonpath = None
     try:
         if 'PYTHONPATH' in os.environ:
             old_pythonpath = os.environ['PYTHONPATH']
             os.environ['PYTHONPATH'] = build_lib + ':' + old_pythonpath
         else:
             os.environ['PYTHONPATH'] = build_lib
         python_exec = os.path.normpath(sys.executable)
         log.info("running unit tests...")
         try:
             cmd = command(python_exec, "-m", "netsa.dist.run_unit_tests",
                           "-v", *self.distribution.netsa_unit_test_modules)
             log.debug("PYTHONPATH=%s %s", os.environ['PYTHONPATH'], cmd)
             run_parallel([cmd], stdout=sys.stdout, stderr=sys.stderr)
         except:
             log.info("running unit tests... failed")
             sys.exit(-1)
         log.info("running unit tests... success")
     finally:
         if old_pythonpath:
             os.environ['PYTHONPATH'] = old_pythonpath
         else:
             del os.environ['PYTHONPATH']
Beispiel #3
0
 def run(self):
     self.run_command('build')
     build_lib = self.get_finalized_command('build').build_lib
     if self.distribution.netsa_doc_dir:
         self.mkpath(self.gen_doc_extra)
         gen_doc_config(self.distribution, self.gen_doc_extra)
         old_pythonpath = None
         try:
             if 'PYTHONPATH' in os.environ:
                 old_pythonpath = os.environ['PYTHONPATH']
                 os.environ['PYTHONPATH'] = (
                     self.gen_doc_extra + ':' + build_lib +
                     ':' + old_pythonpath)
             else:
                 os.environ['PYTHONPATH'] = (
                     self.gen_doc_extra + ":" + build_lib)
             cmd = command("sphinx-build",
                           "-b", "html",
                           "-d", self.gen_doc_extra,
                           os.path.join(self.distribution.source_dir,
                                        self.distribution.netsa_doc_dir),
                           self.gen_doc_html)
             log.info("generating HTML documentation with Sphinx")
             log.debug("PYTHONPATH=%s %s", os.environ['PYTHONPATH'], cmd)
             run_parallel([cmd], stdout=sys.stdout, stderr=sys.stderr)
         finally:
             if old_pythonpath:
                 os.environ['PYTHONPATH'] = old_pythonpath
             else:
                 del os.environ['PYTHONPATH']
Beispiel #4
0
 def run(self):
     self.run_command('build')
     build_lib = self.get_finalized_command('build').build_lib
     if self.distribution.netsa_doc_dir:
         self.mkpath(self.gen_doc_extra)
         gen_doc_config(self.distribution, self.gen_doc_extra)
         old_pythonpath = None
         try:
             if 'PYTHONPATH' in os.environ:
                 old_pythonpath = os.environ['PYTHONPATH']
                 os.environ['PYTHONPATH'] = (
                     self.gen_doc_extra + ':' + build_lib +
                     ':' + old_pythonpath)
             else:
                 os.environ['PYTHONPATH'] = (
                     self.gen_doc_extra + ":" + build_lib)
             cmd = command("sphinx-build",
                           "-b", "latex",
                           "-d", self.gen_doc_extra,
                           os.path.join(self.distribution.source_dir,
                                        self.distribution.netsa_doc_dir),
                           self.gen_doc_latex)
             log.info("generating PDF documentation with Sphinx")
             log.debug("PYTHONPATH=%s %s", os.environ['PYTHONPATH'], cmd)
             try:
                 run_parallel([cmd], stdout=sys.stdout, stderr=sys.stderr)
             except Exception, ex:
                 log.error(str(ex))
                 sys.exit(-1)
         finally:
             if old_pythonpath:
                 os.environ['PYTHONPATH'] = old_pythonpath
             else:
                 del os.environ['PYTHONPATH']
         latex_name = ("%s.tex" % self.distribution.get_name())
         pdf_name = ("%s.pdf" % self.distribution.get_name())
         curdir = os.getcwd()
         try:
             os.chdir(self.gen_doc_latex)
             try:
                 run_parallel(["pdflatex %(latex_name)s"],
                              vars={'latex_name': latex_name})
                 run_parallel(["pdflatex %(latex_name)s"],
                              vars={'latex_name': latex_name})
                 run_parallel(["pdflatex %(latex_name)s"],
                              vars={'latex_name': latex_name})
             except Exception, ex:
                 log.error(str(ex))
                 sys.exit(-1)
         finally:
             os.chdir(curdir)
         self.copy_file(os.path.join(self.gen_doc_latex, pdf_name),
                        self.gen_doc_pdf)
Beispiel #5
0
 def run(self):
     self.run_command('build')
     build_lib = self.get_finalized_command('build').build_lib
     if self.distribution.netsa_doc_dir:
         self.mkpath(self.gen_doc_extra)
         gen_doc_config(self.distribution, self.gen_doc_extra)
         old_pythonpath = None
         try:
             if 'PYTHONPATH' in os.environ:
                 old_pythonpath = os.environ['PYTHONPATH']
                 os.environ['PYTHONPATH'] = (
                     self.gen_doc_extra + ':' + build_lib +
                     ':' + old_pythonpath)
             else:
                 os.environ['PYTHONPATH'] = (
                     self.gen_doc_extra + ":" + build_lib)
             cmd = command("sphinx-build",
                           "-b", "html",
                           "-D", "html_theme=tools_web",
                           "-D", "html_style=tools.css",
                           "-d", self.gen_doc_extra,
                           os.path.join(self.distribution.source_dir,
                                        self.distribution.netsa_doc_dir),
                           os.path.join(self.gen_doc_web, self.base_name))
             log.info("generating tools site HTML documentation with Sphinx")
             log.debug("PYTHONPATH=%s %s", os.environ['PYTHONPATH'], cmd)
             run_parallel([cmd], stdout=sys.stdout, stderr=sys.stderr)
         finally:
             if old_pythonpath:
                 os.environ['PYTHONPATH'] = old_pythonpath
             else:
                 del os.environ['PYTHONPATH']
         log.info("converting UTF-8 to ISO-8859-1")
         convert_html_to_8859_1(os.path.join(self.gen_doc_web,
                                             self.base_name))
         self.make_archive(os.path.join('dist', self.base_name),
                           'gztar', self.gen_doc_web, self.base_name)