Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def cmd_docset_py(options, args):
cmdTimer = CommandTimer('docset_py')
if not os.path.isdir('docs/html'):
msg('ERROR: No docs/html, has the sphinx build command been run?')
sys.exit(1)
# clear out any old docset build
name = 'wxPython-{}'.format(version3)
docset = posixjoin('dist', '{}.docset'.format(name))
if os.path.isdir(docset):
shutil.rmtree(docset)
# run the docset generator
VERBOSE = '--verbose' if options.verbose else ''
runcmd('doc2dash {} --name "{}" --icon {} --destination dist docs/html'
.format(VERBOSE, name, pyICON))
# update its Info.plist file
def cmd_doxhtml(options, args):
cmdTimer = CommandTimer('doxhtml')
_doDox('html')
_doDox('chm')
def _doSimpleSetupCmd(options, args, setupCmd):
cmdTimer = CommandTimer(setupCmd)
VERBOSE = '--verbose' if options.verbose else ''
cmd = '"%s" setup.py %s --skip-build %s %s' % (PYTHON, setupCmd, VERBOSE, options.extra_setup)
runcmd(cmd)
def cmd_clean_wx(options, args):
cmdTimer = CommandTimer('clean_wx')
if isWindows:
if options.both:
options.debug = True
msw = getMSWSettings(options)
deleteIfExists(opj(msw.dllDir, 'msw'+msw.dll_type))
delFiles(glob.glob(opj(msw.dllDir, 'wx*%s%s*' % (wxversion2_nodot, msw.dll_type))))
delFiles(glob.glob(opj(msw.dllDir, 'wx*%s%s*' % (wxversion3_nodot, msw.dll_type))))
if PYTHON_ARCH == '64bit':
deleteIfExists(opj(msw.buildDir, 'vc%s_msw%sdll_x64' % (getVisCVersion(), msw.dll_type)))
else:
deleteIfExists(opj(msw.buildDir, 'vc%s_msw%sdll' % (getVisCVersion(), msw.dll_type)))
if options.both:
options.debug = False
options.both = False
cmd_clean_wx(options, args)
def cmd_dox(options, args):
cmdTimer = CommandTimer('dox')
_doDox('xml')
def cmd_build_py(options, args):
cmdTimer = CommandTimer('build_py')
waf = getWafCmd()
checkCompiler()
BUILD_DIR = getBuildDir(options)
if options.release:
os.environ['WXPYTHON_RELEASE'] = 'yes'
if not isWindows:
WX_CONFIG = posixjoin(BUILD_DIR, 'wx-config')
if options.use_syswx:
wxcfg = posixjoin(options.prefix, 'bin', 'wx-config')
if options.prefix and os.path.exists(wxcfg):
WX_CONFIG = wxcfg
else:
WX_CONFIG = 'wx-config' # hope it is on the PATH
def cmd_bdist_docs(options, args):
cmdTimer = CommandTimer('bdist_docs')
pwd = pushDir(phoenixDir())
cfg = Config()
msg("Archiving wxPython Phoenix documentation...")
rootname = "%s-docs-%s" % (baseName, cfg.VERSION)
tarfilename = "dist/%s.tar.gz" % rootname
if not os.path.exists('dist'):
os.makedirs('dist')
if os.path.exists(tarfilename):
os.remove(tarfilename)
with tarfile.open(name=tarfilename, mode="w:gz") as tarball:
tarball.add('docs/html', os.path.join(rootname, 'docs/html'),
filter=lambda info: None if '.svn' in info.name else info)
def cmd_build_pdbzip(options, args):
if isWindows and options.relwithdebug:
cmdTimer = CommandTimer('build_pdbzip')
if not os.path.exists('dist'):
os.mkdir('dist')
cfg = Config()
filenames = glob.glob('./wx/*.pdb')
if not filenames:
msg('No PDB files found in ./wx!')
return
arch = 'win_amd64' if PYTHON_ARCH == '64bit' else 'win32'
pyver = 'py{}'.format(PYSHORTVER)
zipname = 'dist/{}-pdb-{}-{}-{}.zip'.format(baseName, cfg.VERSION, pyver, arch)
from zipfile import ZipFile, ZIP_DEFLATED
with ZipFile(zipname, 'w', ZIP_DEFLATED) as zip:
for name in filenames:
zip.write(name)
def cmd_etg(options, args):
cmdTimer = CommandTimer('etg')
cfg = Config()
assert os.path.exists(cfg.DOXY_XML_DIR), "Doxygen XML folder not found: " + cfg.DOXY_XML_DIR
pwd = pushDir(cfg.ROOT_DIR)
# TODO: Better support for selecting etg cmd-line flags...
flags = '--sip'
if options.nodoc:
flags += ' --nodoc'
# get the files to run, moving _core the to the front of the list
etgfiles = glob.glob(opj('etg', '_*.py'))
core_file = opj('etg', '_core.py')
if core_file in etgfiles:
etgfiles.remove(core_file)
etgfiles.insert(0, core_file)