Open ecc256 opened 6 years ago
@ecc256 Thank you for the report. Your help to fix this would be highly appreciated as I'm not an expert of pyhon on windows. the "s3cmd" command file is installed with the setup tools standard "script" directive. I'm no idea why it is badly handled on windows. Would you have an idea looking at the setup.py what we could miss for setup tools creating the needed file at installation?
Do you know any python package that does what is needed so that it works as you expect it?
Florent, It’ll be Locust. https://docs.locust.io/en/latest/installation.html
It does install .exe instead of .cmd file. Which is a lot better due to "funny way" of calling one .cmd file from another on windows. By default it execute goto statement - i.e. control never returns to original .cmd script.
That’s why it’s better/more convenient to use dummy .exe file instead.
Thank you for the reference. So I see, it should be handled by the "entry_points" "console_script" of setuptools. But that would fit well with s3cmd and also I don't like very much to use that. A similar case: https://github.com/python/mypy/issues/1226
I keep that on the todo list to see if something can be done with a .bat, or .cmd
IMO, it’ll be quite inconvenient to use with .bat, or .cmd. If possible, better go with .exe.
Namely, to call from another .cmd, we will have to use: For s3cmd.cmd/s3cmd.bat call s3cmd {params}
For s3cmd.exe s3cmd {params}
I use lots of same scripts on windows and linux and will have to change it every time I copy it...
ok, I see. The issue I guess is that if it is a .exe, it necessarily need to something binary, so that have to be built/compiled.
I think, it’s a dummy or generic exe. Folder "C:\Program Files\Python36\Scripts" has quite few of them, all about same size. All they do is run python and pass script as parameter, I think. I.e. xyz.exe should call python.exe xyz.py (or something like this)
Another way is to compile py into exe (Google for these words) I might be wrong completely, I’m not expert in these things...
ah like busybox for linux, the exe could use its filename to find the module to load. When i will have a little time, I would look at the source code of setuptools to see how they do that. Otherwise, it might be possible to use the entry_points feature of setuptools only on windows.
If you update this thread when you done, I'll test it right away! :)
Ok, thank you, will keep you updated
5 years later
Looks like something is amiss with s3cmd install. It supposed to create file s3cmd.cmd in Python\Scripts folder with following content:
@%~dp0..\python %~dp0s3cmd %*
As a result s3cmd is crippled on win. It won’t run same way it runs on linux for example. Instead we have to use smth. like
python c:\Python27\Scripts\s3cmd
which is ridicules :-/ With above file created it’ll run withs3cmd