From: Rob M. <rob...@in...> - 2005-10-10 16:02:14
|
Ok. Thanks Yaroslav,that ought to be enough to get me on the road..the rest is just tinkering around I guess. Thanks once again for your replies. Have a nice day... Rob M. Yaroslav Samchuk wrote: > Rob Marino wrote: > >> I have a lot of 3rd party libraries as well. Twisted and matplotlib >> to name bu two. >> >> Are there any issues with these or are they parsed in during the >> build/link process as well like with >> src2,src3 etc? > > > Yes. I'm sure, you can read this from documentation or from wiki pages. > > But! Sometimes you'll meet some products, which use dynamic/lazy > imports (like the PEAK for example) or some unecessary modules could > be included. In such cases, you will have to specify hidden imports > explicitly or specify packages/modules which should be ommited: > > --------- > SKIP_PACKAGES = [ > 'eggs.spam.larch', > ... > ] > packages = [ ... ] > > data_files = [ > ("templates", glob.glob("eggs/spam/larch/*.pwt") + [...]), > ] > > xml_files = [ > ("eggs/smap", ["eggs/spam/app_config.xml"]), > ... > ] > > ini_files = xml_files[:] > ini_files.extend([ > ("peak", ["peak.ini"]), > ("peak/web", [ > "pwt-schema.ini", "resource_defaults.ini", "sitemap-schema.ini", > ]), > ("peak/ddt", ["resource_defaults.ini"]), > ]) > > hiddenimports = [ > "encodings.ascii", > ..., > > "peak.binding.api", > ..., > ] > > hiddenpackages = [ > "eggs.spam.stuff", > ... > ] > > ... > > class py2exe_build(build_exe): > def create_binaries(self, py_files, extensions, dlls): > for target in ( > self.distribution.console + > self.distribution.service > ): > target.icon_resources=[(0, "spam.ico")] > _copy_ini_files(self, self.collect_dir, ini_files) > return build_exe.create_binaries(self, py_files, > extensions, dlls) > > def get_hidden_imports(self): > rv = build_exe.get_hidden_imports(self) > # TODO: rv.update({modname: [deps], ...}) > return rv > > def get_boot_script(self, boot_type): > if boot_type == "service": > # XXX > return os.path.join(os.path.dirname(__file__), "spam", > "EGGS", "EGGSService.py") > return build_exe.get_boot_script(self, boot_type) > > ... > > ... > > package_dir = {} > > def _add_package(module_prefix, dirname, names): > _dirs = dirname.split(os.sep) > _d = os.path.join(*_dirs) > if _dirs[-1] != "CVS": > _module = ".".join(_dirs) > if not filter(lambda ep: _module.startswith(ep), SKIP_PACKAGES): > if module_prefix: > _module = module_prefix + _module > package_dir[_module] = dirname > packages.append(_module) > > def run_setup(): > os.path.walk("eggs", _add_package, None) > setup( > packages=packages, package_dir=package_dir, > scripts=scripts, > data_files=data_files, > ext_modules=ext_modules, > > cmdclass={ > 'sdist': sdist, 'happy': happy, 'sdist_nodoc': old_sdist, > 'install_data': install_data, 'build': build, > 'py2exe': py2exe_build, > }, > > options={"py2exe": { > "includes": hiddenimports, > "packages": hiddenpackages > }}, > service=["spam.eggs.EGGSService"], > console=["spam/eggs/EGGSTest.py"], > zipfile="library.dat", > ) > --------- > > ... smth like that... > > sorry, I was copy-pasting (as well as deleting and replacing real > names of modules etc) parts of my setup.py without reading the result, > so I can miss smth, but I hope you'll get an idea of the stuff > -- O__ _/`.\ `=( ' |