Ejemplo n.º 1
0
  def BuildWithPyInstaller(self):
    """Use pyinstaller to build a client package."""
    self.CleanDirectory(config_lib.CONFIG.Get("PyInstaller.distpath",
                                              context=self.context))

    logging.info("Copying pyinstaller support files")
    self.spec_file = os.path.join(self.build_dir, "grr.spec")

    with open(self.spec_file, "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.spec", context=self.context))

    with open(os.path.join(self.build_dir, "version.txt"), "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.version",
                                     context=self.context))

    with open(os.path.join(self.build_dir, "grr.ico"), "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.icon", context=self.context))

    # We expect the onedir output at this location.
    self.output_dir = os.path.join(
        config_lib.CONFIG.Get("PyInstaller.distpath", context=self.context),
        "grr-client")

    # Pyinstaller doesn't handle unicode strings.
    args = ["--distpath", str(config_lib.CONFIG.Get("PyInstaller.distpath",
                                                    context=self.context)),
            "--workpath", str(config_lib.CONFIG.Get("PyInstaller.workpath_dir",
                                                    context=self.context)),
            str(self.spec_file)]
    logging.info("Running pyinstaller: %s", args)
    PyInstallerMain.run(pyi_args=[utils.SmartStr(x) for x in args])
Ejemplo n.º 2
0
  def BuildWithPyInstaller(self):
    """Use pyinstaller to build a client package."""
    self.CleanDirectory(config_lib.CONFIG.Get("PyInstaller.distpath",
                                              context=self.context))

    logging.info("Copying pyinstaller support files")
    self.spec_file = os.path.join(self.build_dir, "grr.spec")

    with open(self.spec_file, "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.spec", context=self.context))

    with open(os.path.join(self.build_dir, "version.txt"), "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.version",
                                     context=self.context))

    with open(os.path.join(self.build_dir, "grr.ico"), "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.icon", context=self.context))

    # We expect the onedir output at this location.
    self.output_dir = os.path.join(
        config_lib.CONFIG.Get("PyInstaller.distpath", context=self.context),
        "grr-client")

    # Pyinstaller doesn't handle unicode strings.
    args = ["--distpath", str(config_lib.CONFIG.Get("PyInstaller.distpath",
                                                    context=self.context)),
            "--workpath", str(config_lib.CONFIG.Get("PyInstaller.workpath_dir",
                                                    context=self.context)),
            str(self.spec_file)]
    logging.info("Running pyinstaller: %s", args)
    PyInstallerMain.run(pyi_args=[utils.SmartStr(x) for x in args])
Ejemplo n.º 3
0
    def test_building(self):
        """
        Run building of test script.

        Return True if build succeded False otherwise.
        """
        OPTS = [
            '--debug', '--noupx', '--specpath',
            os.getcwd(), '--distpath',
            os.path.join(os.getcwd(), 'dist'), '--workpath',
            os.path.join(os.getcwd(), 'build')
        ]

        if self.verbose:
            OPTS.extend(['--debug', '--log-level=INFO'])
        else:
            OPTS.append('--log-level=ERROR')

        # Build executable in onefile mode.
        if self.test_file.startswith('test_onefile'):
            OPTS.append('--onefile')
        else:
            OPTS.append('--onedir')

        if self.with_crypto or '_crypto' in self.test_file:
            print('NOTE: Bytecode encryption is enabled for this test.',
                  end="")
            OPTS.append('--key=test_key')

        self._msg("BUILDING TEST " + self.test_name)

        # Use pyinstaller.py for building test_name.
        testfile_spec = self.test_file + '.spec'
        if not os.path.exists(self.test_file + '.spec'):
            # .spec file does not exist and it has to be generated
            # for main script.
            testfile_spec = self.test_file + '.py'

        #pyinst_script = os.path.join(HOMEPATH, 'pyinstaller.py')

        # TODO Fix redirecting stdout/stderr
        # In report mode is stdout and sys.stderr redirected.
        #if self.report:
        ## Write output from subprocess to stdout/err.
        #retcode, out, err = compat.exec_python_all(pyinst_script,
        #testfile_spec, *OPTS)
        #sys.stdout.write(out)
        #sys.stdout.write(err)
        #else:
        #retcode = compat.exec_python_rc(pyinst_script,
        #testfile_spec, *OPTS)
        pyi_args = [testfile_spec] + OPTS
        # TODO fix return code in running PyInstaller programatically
        pyi_main.run(pyi_args, PYI_CONFIG)
        retcode = 0

        return retcode == 0
Ejemplo n.º 4
0
    def test_building(self):
        """
        Run building of test script.

        Return True if build succeded False otherwise.
        """
        OPTS = ['--debug', '--noupx', '--specpath', os.getcwd(), '--distpath',
                os.path.join(os.getcwd(), 'dist'), '--workpath',
                os.path.join(os.getcwd(), 'build')]

        if self.verbose:
            OPTS.extend(['--debug', '--log-level=INFO'])
        else:
            OPTS.append('--log-level=ERROR')

        # Build executable in onefile mode.
        if self.test_file.startswith('test_onefile'):
            OPTS.append('--onefile')
        else:
            OPTS.append('--onedir')

        if self.with_crypto or '_crypto' in self.test_file:
            print('NOTE: Bytecode encryption is enabled for this test.', end="")
            OPTS.append('--key=test_key')

        self._msg("BUILDING TEST " + self.test_name)

        # Use pyinstaller.py for building test_name.
        testfile_spec = self.test_file + '.spec'
        if not os.path.exists(self.test_file + '.spec'):
            # .spec file does not exist and it has to be generated
            # for main script.
            testfile_spec = self.test_file + '.py'

        #pyinst_script = os.path.join(HOMEPATH, 'pyinstaller.py')

        # TODO Fix redirecting stdout/stderr
        # In report mode is stdout and sys.stderr redirected.
        #if self.report:
            ## Write output from subprocess to stdout/err.
            #retcode, out, err = compat.exec_python_all(pyinst_script,
                  #testfile_spec, *OPTS)
            #sys.stdout.write(out)
            #sys.stdout.write(err)
        #else:
            #retcode = compat.exec_python_rc(pyinst_script,
                  #testfile_spec, *OPTS)
        pyi_args = [testfile_spec] + OPTS
        # TODO fix return code in running PyInstaller programatically
        pyi_main.run(pyi_args, PYI_CONFIG)
        retcode = 0

        return retcode == 0
Ejemplo n.º 5
0
    def BuildWithPyInstaller(self):
        """Use pyinstaller to build a client package."""
        self.CleanDirectory(
            config_lib.CONFIG.Get("PyInstaller.distpath",
                                  context=self.context))

        logging.info("Copying pyinstaller support files")
        self.spec_file = os.path.join(self.build_dir, "grr.spec")

        with open(self.spec_file, "wb") as fd:
            fd.write(
                config_lib.CONFIG.Get("PyInstaller.spec",
                                      context=self.context))

        with open(os.path.join(self.build_dir, "version.txt"), "wb") as fd:
            fd.write(
                config_lib.CONFIG.Get("PyInstaller.version",
                                      context=self.context))

        with open(os.path.join(self.build_dir, "grr.ico"), "wb") as fd:
            fd.write(
                config_lib.CONFIG.Get("PyInstaller.icon",
                                      context=self.context))

        # We expect the onedir output at this location.
        self.output_dir = os.path.join(
            config_lib.CONFIG.Get("PyInstaller.distpath",
                                  context=self.context), "grr-client")

        # Pyinstaller doesn't handle unicode strings.
        args = [
            "--distpath",
            str(
                config_lib.CONFIG.Get("PyInstaller.distpath",
                                      context=self.context)), "--workpath",
            str(
                config_lib.CONFIG.Get("PyInstaller.workpath_dir",
                                      context=self.context)),
            str(self.spec_file)
        ]
        logging.info("Running pyinstaller: %s", args)
        PyInstallerMain.run(pyi_args=[utils.SmartStr(x) for x in args])

        with open(os.path.join(self.output_dir, "build.yaml"), "w") as fd:
            fd.write("Client.build_environment: %s\n" %
                     rdf_client.Uname.FromCurrentSystem().signature())
            fd.write("Client.build_time: '%s'\n" %
                     str(rdfvalue.RDFDatetime().Now()))
Ejemplo n.º 6
0
  def BuildWithPyInstaller(self):
    """Use pyinstaller to build a client package."""
    self.CleanDirectory(config_lib.CONFIG.Get("PyInstaller.distpath",
                                              context=self.context))

    logging.info("Copying pyinstaller support files")
    self.spec_file = os.path.join(self.build_dir, "grr.spec")

    with open(self.spec_file, "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.spec", context=self.context))

    with open(os.path.join(self.build_dir, "version.txt"), "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.version",
                                     context=self.context))

    with open(os.path.join(self.build_dir, "grr.ico"), "wb") as fd:
      fd.write(config_lib.CONFIG.Get("PyInstaller.icon", context=self.context))

    # We expect the onedir output at this location.
    self.output_dir = os.path.join(
        config_lib.CONFIG.Get("PyInstaller.distpath", context=self.context),
        "grr-client")

    # Pyinstaller doesn't handle unicode strings.
    args = ["--distpath", str(config_lib.CONFIG.Get("PyInstaller.distpath",
                                                    context=self.context)),
            "--workpath", str(config_lib.CONFIG.Get("PyInstaller.workpath_dir",
                                                    context=self.context)),
            str(self.spec_file)]
    logging.info("Running pyinstaller: %s", args)
    PyInstallerMain.run(pyi_args=[utils.SmartStr(x) for x in args])

    with open(os.path.join(self.output_dir, "build.yaml"), "w") as fd:
      fd.write("Client.build_environment: %s\n" %
               rdf_client.Uname.FromCurrentSystem().signature())
      fd.write("Client.build_time: '%s'\n" %
               str(rdfvalue.RDFDatetime().Now()))
Ejemplo n.º 7
0
#! /usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


"""
Main command-line interface to PyInstaller.
"""
"""
can be usable in both windows and linux;
python pyinstaller.py python-file
"""

if __name__ == '__main__':
    from PyInstaller.main import run
    run()
Ejemplo n.º 8
0
#coding:utf-8
'''
Created on 2015年8月8日 下午2:35:42

@author: TianD

@E-mail: [email protected]

@Q    Q: 298081132
'''
#! /usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
"""    
Main command-line interface to PyInstaller.
"""
# from  PyInstaller import  *
import os

if __name__ == '__main__':
    from PyInstaller.main import run
    #opts=['showUI.py', '-D', '-w', '-nKX_Seq2Mov', '-iE:\\Scripts\\Eclipse\\Seq2Mov\\KX_Seq2Mov.ico']
    opts = ['KX_Seq2Mov.spec', '-y']
    run(opts)
Ejemplo n.º 9
0
#! /usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
"""
Main command-line interface to PyInstaller.
"""
# from  PyInstaller import  *
import  os

if __name__ == '__main__':
    from PyInstaller.main import run
    opts=['course_helper.py','-D','-w','--icon=D:\Python\pyqtfile\course_helper\logo.ico']
    run(opts)
Ejemplo n.º 10
0
#! /usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
"""
Main command-line interface to PyInstaller.
"""

if __name__ == '__main__':
    from PyInstaller.main import run
    run()