Skip to content

Commit

Permalink
Land #401, Bundle pip in Windows frozen builds
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroSteiner committed Sep 20, 2019
2 parents 0b3be4f + 097a898 commit 18b17e6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 0 additions & 2 deletions king_phisher/client/windows/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
import os
import sys
import traceback
import xml.sax.saxutils as saxutils

from king_phisher import startup
from king_phisher import utilities
from king_phisher.catalog import Catalog
from king_phisher.client import plugins
Expand Down
10 changes: 7 additions & 3 deletions king_phisher/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,15 @@ def install_packages(self, packages):
:return: The process results from the command execution.
:rtype: :py:class:`~.ProcessResults`
"""
options = []
pip_options = []
if self.library_path is None:
raise errors.KingPhisherResourceError('missing plugin-specific library path')
options.extend(['--target', self.library_path])
args = [sys.executable, '-m', 'pip', 'install'] + options + packages
pip_options.extend(['--target', self.library_path])
if its.frozen:
args = [os.path.join(os.path.dirname(sys.executable), 'python.exe')]
else:
args = [sys.executable] + pip_options + packages
args += ['-m', 'pip', 'install'] + pip_options + packages
if len(packages) > 1:
info_string = "installing packages: {}"
else:
Expand Down
12 changes: 12 additions & 0 deletions tools/development/cx_freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

import collections
import os
import site
import sys
Expand Down Expand Up @@ -133,6 +134,12 @@
include_files.append(('data/king_phisher', 'king_phisher'))
include_files.append((pytz.__path__[0], 'pytz'))
include_files.append((requests.__path__[0], 'requests'))
include_files.append((collections.__path__[0], 'collections'))

# include pip executible
executable_path = os.path.dirname(sys.executable)
include_files.append((os.path.join(executable_path, 'Scripts'), 'Scripts'))
include_files.append((os.path.join(executable_path, 'python.exe'), 'python.exe'))

exe_base = 'Win32GUI'
if is_debugging_build:
Expand All @@ -157,6 +164,7 @@
'cffi',
'collections',
'cryptography',
'distutils',
'dns',
'email',
'email_validator',
Expand All @@ -177,6 +185,10 @@
'numpy',
'paramiko',
'pil',
'pip',
'os',
'six',
'sys',
'pkg_resources',
'pluginbase',
'qrcode',
Expand Down

0 comments on commit 18b17e6

Please sign in to comment.