Without much knowledge of Wine, I'd work around that problem making the program happy and giving it a disk that is smaller than 2 GB.
It's very simple. First, create a file filled with 0s that is 512 MB (or more, but less than 2048):
dd if=/dev/zero of=smalldisk.img bs=1M count=512
Next, format it using the default file system:
mkfs smalldisk.img
Move the existing directory to a temporary name:
mv .wine-demo .wine-demo-orig
Mount the new disk as a loop device at the original location:
sudo mount smalldisk.img .wine-demo
sudo chown your-user-name: .wine-demo
Copy the entire tree in:
cp -r .wine-demo-orig/* .wine-demo
And run the program from there. If it still doesn't work, then you'll need a different solution.
(There is, unfortunately, a chance that it won't work. If it can't handle 2 GB of disk space, it will probably not handle 2 GB of RAM...)
Provided it works, I suggest your unmount it and put it in your /etc/fstab
:
/path/to/smalldisk.img /path/to/mount ext4 auto,noexec,rw,loop,fmask=0177,dmask=0077,user 0 0
In this line fmask
and dmask
are mask permissions for files and directories. Notice that they are the opposite of what you would use with chmod
. That is, 7
stands for no permissions (---
) and 0
stands for full permissions (wrx
). Read more here: fstab Permission Masks Explained.
First note that foreground-window and window-with-keyboard-focus are not the same thing. They are for Mircosoft's Windows, and for a lot of window managers, but not necessarily. For example KDE can manage these two properties separately.
Now about your question, like the point I made above, it will depend on the window manager. In Kde there are setting that allow you to control keyboard focus, even settings that depend on the application (but still part of the window manager). The above image shows how to do the opposite (set accept focus to yes to do what you are asking for). I tested this configured for one application.
Do not mix up the role of window-manager, launcher etc. Both KDE, Gnome, LXDE and others do all of these. The window manager manages which windows are where, there size, whether they are minimise, which one are behind which, which has keyboard focus. The application can also control this, and so can another application, but ultimately it is the process that is registered as the window manager, that is in charge. It can block other processes from doing these things, and decides where a window is mapped, and whether it gets keyboard focus, when first mapped (or ever). The only visible part of the window manager is the title bar(+close, maximise, minimise etc icons) of all of the other windows.
Best Answer
Few users need to run Python under Wine, since Python works very well natively on all the systems that Wine works on. However, there are reasons to do it and it seems you have one (building a Windows installer with PyInstaller).
Some versions of Python certainly can run on some versions of Wine. Unfortunately, you've run into a combination that doesn't work.
What's happening
It looks like you're running into Bug #39437: "Visual Studio 2015-compiled C++ programs do not run".
The program you're running uses a function called
_initialize_onexit_table
from a library calledapi-ms-win-crt-runtime-l1-1-0.dll
.Wine provides its own version of
api-ms-win-crt-runtime-l1-1-0.dll
but it did not support the_initialize_onexit_table
function until relatively recently (mid-2016). Wine 2.0 is the first Stable release that supports this function, although Development versions have supported it since 1.9.9.Wine 2.0 will probably be released in the next couple of weeks, but release candidates are already available.Wine 2.0 was released a couple of weeks after this question was posted.Can't upgrade Wine?
On a Windows computer, you'd be using Microsoft's version of that library. If you have a copy of Microsoft's version, you can configure Wine to use it instead of its builtin version.
You can use Wine's
override
system to achieve this (using winecfg or setting theWINEDLLPATH
andWINEDLLOVERRIDES
environment variables).There is a project called Winetricks which can download Microsoft's libraries and configure your Wine to use them.
In conclusion
Upgrade your Wine version, or downgrade your Python version.
There are ways around it if you can't upgrade, but upgrading is probably your best option.