3 examples of 'how to create exe file' in Python

Every line of 'how to create exe file' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
241def make_exe(fn):
242 if hasattr(os, 'chmod'):
243 oldmode = os.stat(fn).st_mode & 07777
244 newmode = (oldmode | 0555) & 07777
245 os.chmod(fn, newmode)
246 logger.info('Changed mode of %s to %s', fn, oct(newmode))
851def install_exe(self, dist_filename, tmpdir):
852 # See if it's valid, get data
853 cfg = extract_wininst_cfg(dist_filename)
854 if cfg is None:
855 raise DistutilsError(
856 "%s is not a valid distutils Windows .exe" % dist_filename
857 )
858 # Create a dummy distribution object until we build the real distro
859 dist = Distribution(
860 None,
861 project_name=cfg.get('metadata','name'),
862 version=cfg.get('metadata','version'), platform=get_platform(),
863 )
864
865 # Convert the .exe to an unpacked egg
866 egg_path = dist.location = os.path.join(tmpdir, dist.egg_name()+'.egg')
867 egg_tmp = egg_path + '.tmp'
868 _egg_info = os.path.join(egg_tmp, 'EGG-INFO')
869 pkg_inf = os.path.join(_egg_info, 'PKG-INFO')
870 ensure_directory(pkg_inf) # make sure EGG-INFO dir exists
871 dist._provider = PathMetadata(egg_tmp, _egg_info) # XXX
872 self.exe_to_egg(dist_filename, egg_tmp)
873
874 # Write EGG-INFO/PKG-INFO
875 if not os.path.exists(pkg_inf):
876 f = open(pkg_inf,'w')
877 f.write('Metadata-Version: 1.0\n')
878 for k,v in cfg.items('metadata'):
879 if k != 'target_version':
880 f.write('%s: %s\n' % (k.replace('_','-').title(), v))
881 f.close()
882 script_dir = os.path.join(_egg_info,'scripts')
883 self.delete_blockers( # delete entry-point scripts to avoid duping
884 [os.path.join(script_dir,args[0]) for args in get_script_args(dist)]
885 )
886 # Build .egg file from tmpdir
887 bdist_egg.make_zipfile(
888 egg_path, egg_tmp, verbose=self.verbose, dry_run=self.dry_run
889 )
890 # install the .egg
891 return self.install_egg(egg_path, tmpdir)
10def exe():
11 return (os.environ.get('BUP_MAIN_EXE') or
12 os.path.join(startdir, sys.argv[0]))

Related snippets