If a folder is read-only, where do the pyc files go? - windows

I am running .py files from a read-only network folder (via Python 2.7 on Windows). Are pyc files still generated? And if so, where do they go?

The contents are generated by the compiler, but they are simply not saved (a loader may set an alternate __cached__, but normally doesn't). The .pyc files are merely used to cache the result of the compilation. distutils.util.byte_compile has some documentation links for further details.

Related

Why Do the Lua Binaries Contain .h and .c Files, but Lua IUP Binaries Contain .DLLs?

I'm trying to update an old app that uses Lua and IUP, but I'm not very experienced, so I'm wondering if I have too many files. I originally downloaded Lua 5.4.3 and followed a tutorial on how to turn those .c and .h files into Lua.dll, Lua.exe, Lua.lib, and Luac.exe.
Then I downloaded iup-3.30-Lua54_Win64_bin.zip and extracted to it's own folder. That folder contains a bunch of .DLLs and a few .EXEs. Since those files have their own interpreter (iuplua54.exe), are the files in Lua 5.4.3 unnecessary? Why do these downloads have different file types? Did I install them wrong or did I get the wrong files?
I'm having issues with different Lua .exe files giving me different errors when I try to open a particular .lua script.

Two vimfiles directories. Where do I install my plugins?

I'm using Windows 10.
I want to give Vim another shot after having some troubles with it in the past. I'm eager to learn it, but I'm confused. I gave a pretty thorough search to find my answer before I resorted to posting this here, but what is the proper way to install my vim plugins. I see two vimfiles folders in two different directories.
One in the $HOME directory.
C:\User\[USERNAME]\vimfiles
And one in the installation directory.
C:\Program Files (x86)\Vim\vimfiles
Is there a reason for there being two of these ? What's the best directory to install my plugins ?
It is related to 'runtimepath' param. Read :help 'runtimepath' for more info . C:\Program Files (x86)\Vim\vimfiles is system folder with default plugins which are shipped with vim itself. C:\User\[USERNAME]\vimfiles is your local runtimepath. And there you should put your plugins. This way if you have multiple users they all will have own vim environment to work in. If you want you can even set different runtimepath but this is whole another question))
C:\User\[USERNAME]\vimfiles is your vim runtime files and C:\Program Files (x86)\Vim\vimfiles is Vim's runtime files. As long as a feature is present in your vim runtime files and vim request it, it will load them and if its not present there, then it will fallback to his runtime path to find it (i.e. C:\Program Files (x86)\Vim\vimfiles ). So you should always install your plugins, colorschemes, syntaxes, ... in your vim runtime files and also back it up in a safe place and never touch vim's runtime files.

How to build libpng using gcc?

I am currently working on a program that will have to be able to read and save PNG files. I've decided to use libpng so I've downloaded it's source files. I unpacked them and here is where my problem started.
There are very many files in the unpacked folder and I don't know which of them I should compile to get proper.o files that I will be able to link to my program.
There are makefiles in the libpng "scripts" directory. Most of those contain a list of the files that need to be compiled (namely, all of png*.c in the main libpng directory except for pngtest.c).
You'll also need pnglibconf.h which you can create by copying scripts/pnglibconf.h_prebuilt.

What file permissions are needed in an XPI?

I recently received the following comment from the reviewer of one of my add-ons at the official Mozilla Add-ons website:
The permissions in your XPI are broken. Most files and directories do not have the expected read and execute permissions, or indeed any permissions at all.
I wasn't aware that file permissions were an issue in XPI files. To my knowledge, none of the files in my XPI need the execute bit set (I only package standard stuff: XUL, JavaScript, CSS, etc). I create my XPI in Windows using the Cygwin zip tool, and since Windows knows nothing about file permissions, they aren't stored as they would be in Linux.
What file permissions are expected for file and directory entries in an XPI? The Extension Packaging page at MDN has the following quote, but no associated details on what they should be:
... you must verify that the file system permissions for the directories and files for the extension are set properly. Otherwise, the Extension Manager may not function properly with the extension or the extension itself may not work properly.
This is typically an issue if you create the extension package on Windows but the extension is used on Linux or OS X later - Windows doesn't have any file permissions to be put into a ZIP archive and unpacking on Linux or OS X sometimes creates bogus file permissions (000 rather than the usual 755 or 644). You could try using a different ZIP packer, e.g. Info-ZIP that doesn't cause such issues for me. Better yet, don't require your extension to be unpacked at all - <em:unpack> is often used but rarely really required.

How is the mac os executable bit preserved in Windows?

I have two Macs, and a shared folder on a third Windows computer. If I do something like this:
Copy an executable console application (not a .app file - a single file which is executable) from Mac 1 to Windows machine
Zip executable on Windows machine
Copy new zip file to Mac 2 and unzip
The file that comes out of the zip file is still executable. How is the "executable-ness" nature of that file preserved, given that windows permissions system is totally different and doesn't really have the concept of executable files?
OSX Apps are folders, not files. When copying folders to a file system, that doesn't have executable bit representation, OSX creates hidden files for the missing attributes. Zipping the App is zipping a folder, including its hidden subfolders. On copy back, OSX will recreate the missing properties from the hidden files.
These hidden folders are called ._.OriginalName
EDIT
After quite extensive discussion in the comments sections, here is a bit of info about simple executable files (execute permission set) as opposed to *.app folders (native OSX applications)
Ofcourse OSX honours the executable permissions, (set and unset)
Copying a file to a file system, that does not have a concept of an executable permission (most prominently FAT formated USB sticks), then copying it back after a rename on another OS leaves OSX with the dilemma of whether to see the file as executable or not - the ._.OriginalName metadata store is decoupled from the file by the rename
OSX solves this dilemma by setting the permissions to 700 or 777, thus making every file executable

Resources