I am packaging a Python 2.7 program with the lastest version of Pynsist.
I’ve created an installer.cfg file following this example.
But when I try to package my application running
pynsist installer.cgf
into the application folder it comes up with
Copying Python installer to build directory PyLauncher MSI already in build directory. Copying packages into build directory... Traceback (most recent call last): File "/usr/local/bin/pynsist", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/nsist/__init__.py", line 540, in main InstallerBuilder(**args).run(makensis=(not options.no_makensis)) File "/usr/local/lib/python2.7/dist-packages/nsist/__init__.py", line 495, in run self.prepare_packages() File "/usr/local/lib/python2.7/dist-packages/nsist/__init__.py", line 381, in prepare_packages py_version=self.py_version, exclude=self.exclude) File "/usr/local/lib/python2.7/dist-packages/nsist/copymodules.py", line 224, in copy_modules mc.copy(modname, target, exclude) File "/usr/local/lib/python2.7/dist-packages/nsist/copymodules.py", line 195, in copy check_package_for_ext_mods(path, self.py_version) File "/usr/local/lib/python2.7/dist-packages/nsist/copymodules.py", line 41, in check_package_for_ext_mods check_ext_mod(os.path.join(path, dirpath, filename), target_python) File "/usr/local/lib/python2.7/dist-packages/nsist/copymodules.py", line 30, in check_ext_mod raise ExtensionModuleMismatch(extensionmod_errmsg % ('Windows', path)) nsist.copymodules.ExtensionModuleMismatch: Found an extension module that will not be usable on Windows: /usr/lib/python2.7/dist-packages/pygame/rwobject.so Put Windows packages in pynsist_pkgs/ to avoid this.
So the problem I think is with Pygame.
On Google there in nothing about this, but i cannot use others programs for packaging(eg. py2exe, pyinstaller ecc…).
Thanks and sorry for the bad english
Advertisement
Answer
Reposting as an answer, since it worked:
If you put pygame in packages=
, it tries to copy it from your computer. But on your computer that’s pygame for Linux, which won’t work on Windows. If you instead put pygame in the pypi_wheels=
bit of the config file, Pynsist will take care of downloading a Windows version for you.
Have a look at the pygame example in the Pynsist repository.
Most packages don’t have this problem because they only contain Python code, which is the same files on all platforms. Pygame has compiled modules, which have to be compiled for the right platform.