Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
except LookupError:
pass
# path from Python import system
try:
names = name.split('.')
for i in range(len(names)):
modname = '.'.join(names[:i + 1])
__import__(modname)
return getattr(sys.modules[name], '__path__', [])[1:]
except ImportError:
pass
return default
def __setitem__(self, name, value):
packagePathMap[name] = value
modulefinder.packagePathMap = PackagePathMap()
# fix a problem that `py2exe` includes MinWin's ApiSet Stub DLLs on Windows 7.
# http://www.avertlabs.com/research/blog/index.php/2010/01/05/windows-7-kernel-api-refactoring/
if sys.getwindowsversion()[:2] >= (6, 1):
build_exe._isSystemDLL = build_exe.isSystemDLL
def isSystemDLL(pathname):
if build_exe._isSystemDLL(pathname):
return True
try:
language = win32api.GetFileVersionInfo(pathname,
'\\VarFileInfo\\Translation')
company = win32api.GetFileVersionInfo(pathname,
'\\StringFileInfo\\%.4x%.4x\\CompanyName' % language[0])
# setup.py
import time
import sys
try:
import py2exe.mf as modulefinder
import win32com
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", p)
for extra in ["win32com.shell"]:
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
pass
from distutils.core import setup
import py2exe
# gui panels to include
includePanels=[
"standardOverview","standardDetails","standardGrid","standardPager","standardFilter",
"TextButton","btn_DetailsHeader","tribler_List","profileOverviewPanel"]
################################################################
#
# Setup script used for py2exe
#
import pygst
pygst.require('0.10')
import gst
try:
import py2exe.mf as modulefinder
except ImportError:
import modulefinder
import win32com
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", p)
for extra in ["win32com.shell"]: #,"win32com.mapi"
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
try:
import py2exe
except ImportError:
pass
mfcdir = 'C:\\Python26\\Lib\\site-packages\\pythonwin'
gstPath = "C:\\Program Files\\OSSBuild\\GStreamer\\v0.10.7"
mfcfiles = [path.join(mfcdir, i) for i in ["mfc90.dll","mfc90u.dll" ,"mfcm90.dll","mfcm90u.dll","Microsoft.VC90.MFC.manifest"]]
print ('Deploying GStreamer')
# Copy gstreamer binaries to the dist folder
for name in os.listdir(os.path.join(gstPath, 'bin')):
shutil.copy (os.path.join(gstPath, 'bin', name),
os.path.join (os.getcwd(), 'dist\\bin'))
## copy ffmpeg dir
if not os.path.exists(os.path.join(os.getcwd(), 'dist\\ffmpeg')):
# one. If this new modulefinder gets integrated into Python, then
# we might be able to revert this some day.
# if this doesn't work, try import modulefinder
try:
import py2exe.mf as modulefinder
except ImportError:
import modulefinder
import win32com, sys
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", p)
for extra in ["win32com.shell"]: # ,"win32com.mapi"
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
# no build path setup, no worries.
pass
def tree(src):
return [(root, map(lambda f: os.path.join(root, f), files))
for (root, dirs, files) in os.walk(os.path.normpath(src))]
ENTRY_POINT = ['main.py']
DATA_FILES = tree('static') + tree('templates')
PACKAGES = []
OPTIONS = {
# bundling application (bundle_files = 1) does not work for some reason.
# setup.py
import sys
import os
try:
import py2exe.mf as modulefinder
import win32com
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", p)
for extra in ["win32com.shell"]:
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
pass
from distutils.core import setup
import py2exe
from Tribler.__init__ import LIBRARYNAME
#
#
# Setup script used for py2exe
# setup.py
import time
import sys
try:
import py2exe.mf as modulefinder
import win32com
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", p)
for extra in ["win32com.shell"]:
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
pass
from distutils.core import setup
import py2exe
# gui panels to include
includePanels=[
"standardOverview","standardDetails","standardGrid","standardPager","standardFilter",
"TextButton","btn_DetailsHeader","tribler_List","profileOverviewPanel"]
try:
import py2exe.mf as modulefinder
except ImportError:
import modulefinder
import win32com
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath(win32_folder, p)
for extra in ["win32com.shell", "win32com.adsi", "win32com.axcontrol",
"win32com.axscript", "win32com.bits", "win32com.ifilter",
"win32com.internet", "win32com.mapi", "win32com.propsys",
"win32com.taskscheduler"]:
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
# no build path setup, no worries.
pass
# Remove the build folder
shutil.rmtree("build", ignore_errors=True)
# do the same for dist folder
shutil.rmtree("dist", ignore_errors=True)
is_64bits = sys.maxsize > 2**32
arch = "amd64" if is_64bits else "x86"
manifest = """
# This means we have to add package paths there, not to the built-in
# one. If this new modulefinder gets integrated into Python, then
# we might be able to revert this some day.
# if this doesn't work, try import modulefinder
try:
import py2exe.mf as modulefinder
except ImportError:
import modulefinder
import win32com, sys
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", p)
for extra in ["win32com.shell"]: #,"win32com.mapi"
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
# no build path setup, no worries.
pass
from distutils.core import setup
import py2exe
platform_options = {
"console": [{
"script": "main.py",
"icon_resources": [(1, "icon.ico")],
"dest_base": "PiniEngine",
}],
"zipfile": None,
"setup_requires": ["py2exe"],
"options": {
os.path.dirname(__file__), os.path.pardir, os.path.pardir))
sys.path.append(os.path.join(umit_top_dir, common.BIN_DIRNAME))
# win32com changes its __path__ to be able to do imports from
# win32comext (which is not a python package), but the modulefinder
# does not handle such situtation and thus win32com.shell (which is
# really win32comext.shell) cannot be found. Let's fix this here so
# umit.core.BasePaths still works after we run py2exe over it.
try:
import py2exe.mf as modulefinder
except ImportError:
# This py2exe is too old, will use the standard modulefinder
import modulefinder
import win32com
for path in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", path)
class umit_py2exe(build_exe):
def run(self):
build_exe.run(self)
self.finish_banner()
def finish_banner(self):
print
print "%s The compiled version of Umit %s is in ./dist %s" % \
("#"*10, VERSION, "#"*10)
print
py2exe_cmdclass = {"py2exe": umit_py2exe}
py2exe_options = dict(
# Solution taken from here: http://www.py2exe.org/index.cgi/win32com.shell
# ModuleFinder can't handle runtime changes to __path__, but win32com uses them
win32_folder = "win32comext"
try:
# py2exe 0.6.4 introduced a replacement modulefinder.
# This means we have to add package paths there, not to the built-in
# one. If this new modulefinder gets integrated into Python, then
# we might be able to revert this some day.
# if this doesn't work, try import modulefinder
try:
import py2exe.mf as modulefinder
except ImportError:
import modulefinder
import win32com
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath(win32_folder, p)
for extra in ["win32com.shell", "win32com.adsi", "win32com.axcontrol",
"win32com.axscript", "win32com.bits", "win32com.ifilter",
"win32com.internet", "win32com.mapi", "win32com.propsys",
"win32com.taskscheduler"]:
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
# no build path setup, no worries.
pass
# Remove the build folder
shutil.rmtree("build", ignore_errors=True)
# do the same for dist folder