Automatically Preparing Plugins for Distribution

On 13/08/2015 at 11:26, xxxxxxxx wrote:


This is perhaps more of a general Python question, than a Py4D question, but I thought I'd run it by you guys. Do you have any recommendations on how to automatically prepare your plugins for distribution?

My current system

1. Commit my source in Git (private hosting via BitBucket).
2. Manually increment version number in README, and source files.
2b. Review my commit history between my last distribution and the current version, and update the Changelog in my plugin's documentation.
3. Duplicate my "src" directory, give it the same name as my plugin
4. Manually source-protect all of my .pyp files
5. Run python script to byte-compile all of my libs
6. Delete all of my .pyp and .py files
7. .zip up the "PluginName" directory.
8. Rename the .zip "PluginName v01_05" or whatever the version is.
9. Move the .zip into a "distributions" folder in my repo.
10. Commit my updated repo.
11. Upload the file to my website / distribution location.

Why certainly not difficult, this process gets a little bit tedious, especially when I'm updating dozens of plugins. To the point that I don't update for minor bugfixes, but instead wait for big version changes - to the detriment of my end-users.

I'm looking for something that will automate as much of the above process as possible. Any suggestions?

I can probably write a python script that does most of the above, but I suspect someone else has already solved this problem. If not, any suggestions on how to source protect more than one .pyp file at a time?



On 14/08/2015 at 08:28, xxxxxxxx wrote:

Hi Donovan,

The process I use isn't so different from yours. Unfortunately there seems to be no way from Cinema 4D
to protect a PYP file without GUI, otherwise it would be possible to automate the PYP protection as well.
To make quick distribution easier, I make sure that I do not  have to delete any files manually. I do not
put any files in the res  folder that I have to take away for distribution.

I usually use external modules already in byte-compiled format or distribute them in source format.
For libraries that I develop explicitly for a plugin (eg. the Python API for my PV Render Queue 2 plugin),
I leave the library in a separate folder which I call devel. From the Python plugin, I then use

module_path = res.file('devel', 'nr.pvrq2')
if os.path.isdir(module_path) :
elif sys.version.startswith('2.6') :
  module_path = res.file('res', 'modules', 'nr.pvrq2-2.0.0.dev0-py2.6.egg')
elif sys.version.startswith('2.7') :
  module_path = res.file('res', 'modules', 'nr.pvrq2-2.0.0_dev-py2.7.egg')

To decide which version to use. To create the binary distributions, I use Creator (but you can also
write a Shell, Batch or Makefile for it).

# = nr.pvrq2
define('bdist_dir', '$ProjectPath/res/modules')
def symbols() :
  shell('python -m symbols pyclass -F')
def bdist() :
  cwd = 'devel/nr.pvrq2'
  shell('python2.6 bdist_egg --dist-dir $"bdist_dir', cwd=cwd)
  shell('python2.7 bdist_egg --dist-dir $"bdist_dir', cwd=cwd)

Then I simply run

~/Applications/Cinema 4D R16/plugins/pv_renderqueue niklas $ creator bdist

and it creates the Eggs.


On 16/08/2015 at 09:40, xxxxxxxx wrote:

Regarding automated source protection of .pyp files, you can actually do it with my Apex plugin.
Check here.

On 17/08/2015 at 11:41, xxxxxxxx wrote:

Niklas - thank you so much for the detailed response. I've decided to avoid source protecting libs at all costs so that I can avoid at least some of these issues. Thanks for directing me to Apex, being able to source-protect more than one .pyp at a time is a huge convenience.