Page 1 of 1

[Solved] How to call RenPy distribute from the command line

Posted: Sun Oct 23, 2022 7:24 am
by Rabid
Hello.

I want to set up an automatic pipeline to automatically build and generate the different builds for my game.

How can this be achieved from the command line? I can't find anywhere documentation regarding what arguments does it accept like how can you specify which distributions you want, for example.

Thanks in advance.

Re: How to call RenPy distribute from the command line

Posted: Sun Oct 23, 2022 10:55 am
by Tess
I had a really good discussion with someone over here about how to do Ren'Py commands from the terminal: viewtopic.php?f=8&t=65466

If you're on Windows, I believe you can go to your Ren'Py directory and type:

Code: Select all

lib/py2-windows-i686/python.exe renpy.py -h
to get a list of console commands and a little information on what they do.

I'm assuming it would be similar on Linux, but the exe would be an sh file instead. Don't use Linux much though, so take that with a grain of salt.
Have no idea how it works on Mac unfortunately.

Re: How to call RenPy distribute from the command line

Posted: Sun Oct 23, 2022 2:10 pm
by Rabid
Thanks for pointing me the existence of that python.exe inside the lib folder, I was getting some weird af errors and that got rid of those.

However I can't still get it to work, not even output the help for the distribute command.

My RenPy 8.0.3 is installed at D:\RenPy\renpy-8.0.3-sdk
My game is at D:\VisualNovelGame (this is the folder that has the game folder inside it)

So what I do is run the following command

Code: Select all

D:\RenPy\renpy-8.0.3-sdk\lib\py3-windows-x86_64\python.exe D:\RenPy\renpy-8.0.3-sdk\renpy.py D:\VisualNovelGame distribute -h
But the output I get is

Code: Select all

usage: renpy.py [--savedir DIRECTORY] [--trace LEVEL] [--version] [--compile] [--keep-orphan-rpyc] [--errors-in-editor] [--safe-mode] [--json-dump FILE]
                [--json-dump-private] [--json-dump-common] [-h]
                basedir command
renpy.py: error: Command distribute is unknown.
So I thought maybe I typed wrongly the distribute command, just to double check I ran the same command but without the distribute option

Code: Select all

D:\RenPy\renpy-8.0.3-sdk\lib\py3-windows-x86_64\python.exe D:\RenPy\renpy-8.0.3-sdk\renpy.py D:\VisualNovelGame -h
Surprisingly the output didn't mention that the distribute command even existed

Code: Select all

. . .

The Ren'Py visual novel engine.

positional arguments:
  basedir              The base directory containing of the project to run. This defaults to the directory containing the Ren'Py executable.
  command              The command to execute. Available commands are: add_from, compile, dialogue, director, extract_strings, gui_images, lint,
                       merge_strings, quit, rmpersistent, run, test, translate, update. Defaults to 'run'.
. . .
So after a lot of tries, I ran the same command but WITHOUT the base dir of my game, like so:

Code: Select all

D:\RenPy\renpy-8.0.3-sdk\lib\py3-windows-x86_64\python.exe D:\RenPy\renpy-8.0.3-sdk\renpy.py -h
Then the output did mention the distribute command

Code: Select all

. . .

The Ren'Py visual novel engine.

positional arguments:
  basedir              The base directory containing of the project to run. This defaults to the directory containing the Ren'Py executable.
  command              The command to execute. Available commands are: add_from, android_build, compile, dialogue, director, distribute, extract_strings,
                       generate_gui, get_projects_directory, gui_images, ios_create, ios_populate, lint, merge_strings, quit, rmpersistent, run,
                       set_projects_directory, test, translate, update, update_old_game. Defaults to 'run'.
. . .
So I don't know what I'm doing wrong, if I type any command without providing my game's base dir it just complains that basedir is needed.

Any tips? I'm on Win10 btw

Re: How to call RenPy distribute from the command line

Posted: Sun Oct 23, 2022 7:05 pm
by Zetsubou
"distribute" appears to be a command of the "launcher" project in your sdk folder, not one from renpy.py itself.
So the syntax is a little different.

Code: Select all

./renpy.sh launcher distribute the_question
So from your examples it would be

Code: Select all

D:\RenPy\renpy-8.0.3-sdk\lib\py3-windows-x86_64\python.exe D:\RenPy\renpy-8.0.3-sdk\renpy.py D:\RenPy\renpy-8.0.3-sdk\launcher distribute D:\VisualNovelGame

Re: How to call RenPy distribute from the command line

Posted: Mon Oct 24, 2022 12:37 pm
by Rabid
Thanks a lot, that did indeed work. I have other question though, what about android and web builds? I have only seen options for android but no mention of web from the command line arguments.

Re: How to call RenPy distribute from the command line

Posted: Tue Oct 25, 2022 5:48 am
by Zetsubou
I don't know about the web build. I haven't tried building it before and didn't see anything in the CLI help menu.
Android is straightforward though. In the help menu text you posted above

Code: Select all

. . .

The Ren'Py visual novel engine.

positional arguments:
  basedir              The base directory containing of the project to run. This defaults to the directory containing the Ren'Py executable.
  command              The command to execute. Available commands are: add_from, android_build, compile, dialogue, director, distribute, extract_strings,
                       generate_gui, get_projects_directory, gui_images, ios_create, ios_populate, lint, merge_strings, quit, rmpersistent, run,
                       set_projects_directory, test, translate, update, update_old_game. Defaults to 'run'.
. . .
it mentions android_build, which is the command you need.
The syntax is the same as for distribute, but replacing "distribute" with "android_build".
For more information you can use the -h parameter like usual. eg.

Code: Select all

./renpy.sh launcher android_build the_question -h
but with the paths you used before.

Re: How to call RenPy distribute from the command line

Posted: Tue Oct 25, 2022 3:13 pm
by Rabid
Thanks a lot then I consider this solved :)