Sunday Pipeline (Maya) – Install and Update Python Source Code

I been asked a few times on how the Sunday Pipeline install script works – how it only takes 4 lines of Python to get the entire Pipeline and run it. It’s actually pretty simple and there isn’t much to it for anyone with a bit of python knowledge :)

There is an install function, simple version function and an update function – which if valid runs the install function (again). When firing the 4 lines of code the install python file is fetches to the OS temp directory and install pipeline is run. The installer unloads the plugin that is used for setting up the Pipeline environment and removes the old Pipeline if it exists. Then a few zip archives is downloaded and unziped to the Maya preferences directory and some cleaning of OS X hidden directory is done (just because I don’t wan’t to do that every time i zip an update manually). Then the new plugin loads and is set to autoload.

The update function opens the install python file from 3dg.dk and checks if the version number function has increased from the local version. If valid a dialog is shown and if ‘YES’ is pressed the install function from the online install script is run. There is also a ‘CHANGE LOG’ button on the update dialog – it just opens a browser to the changelog bookmark on the 3DG.DK pipeline page.

The Install Code from the Maya Pipeline (Maya) Public Page

import tempfile,urllib2,os,imp f=tempfile.gettempdir()+os.sep+'SundayInstallPipelinePublicPy.py' open(f,'wb').write(urllib2.urlopen('http://tinyurl.com/3tkj9l8').read()) imp.load_source('module.name',f).SundayInstallPipeline()

The Install Script Source Code | UPDATED: December 7, 2011

Get the latest version from Sunday Pipeline (Maya) by pressing the download button.
Rename the file from “.temp” to “.py”.

Download

#################################################################################################### ''' * * SundayInstallPipelinePublicPy.py * Version 0.6 * Sunday Studio Pipeline (Maya) * * Maintained by Christian Esbo Agergaard - www.3dg.dk * Copyright Sunday Animation Studio ApS and Christian Esbo Agergaard 2011 | sundaystudio.com * ''' # Fetch Pipeline ''' import tempfile,urllib2,os,imp f=tempfile.gettempdir()+os.sep+'SundayInstallPipelinePublicPy.py' open(f,'wb').write(urllib2.urlopen('http://3dg.dk/sundaypipeline/mayapublic/SundayInstallPipelinePublicPy.temp').read()) imp.load_source('module.name',f).SundayInstallPipeline() ''' #################################################################################################### import maya.cmds as cmds import maya.mel as mel import os import time import urllib2, zipfile, shutil, tempfile, imp #################################################################################################### def SundayInstallPipelineVersion(): pipelineVersion = 0.6 return pipelineVersion #################################################################################################### def SundayInstallPipelineCheckForUpdate(mode): import SundaySetupPublicPy reload(SundaySetupPublicPy) import SundayDialogPy reload(SundayDialogPy) fetchFile = tempfile.gettempdir() + os.sep + 'SundayInstallPipelinePublicPy.py' try: open(fetchFile, 'wb').write(urllib2.urlopen('http://3dg.dk/sundaypipeline/mayapublic/SundayInstallPipelinePublicPy.temp').read()) except: if (mode == 'active'): SundayDialogPy.SundayDialogConfirm('Error Fetching Pipeline From Online Repository ', 'Check Net Connection or Firewall Settings', 'OK') else: print 'Error Fetching Pipeline From Online Repository - Check Net Connection or Firewall Settings' return onlineVersion = imp.load_source('module.name', fetchFile).SundayInstallPipelineVersion() if (onlineVersion > SundayInstallPipelineVersion()): updateResult = SundayDialogPy.SundayDialogPromptYesNoCancel('New Sunday Pipeline Version: ' + str(onlineVersion) + ' ', 'Update now?', ' CHANGE LOG ', 'YES', 'NO') if (updateResult == 'YES'): try: SundaySetupPublicPy.SundaySetupSettingssUIClose() except: pass imp.load_source('module.name', fetchFile).SundayInstallPipeline() if (updateResult == ' CHANGE LOG '): cmds.showHelp( "http://www.3dg.dk/2011/08/12/sunday-pipeline-maya-public/#changelog", absolute=True ) else: if (mode == 'active'): SundayDialogPy.SundayDialogConfirm('Sunday Pipeline Is Up To Date ', 'Current Version: ' + str(SundayInstallPipelineVersion()), 'OK') else: print 'Sunday Pipeline Is Up To Date. Current Version: ' + str(SundayInstallPipelineVersion()) #################################################################################################### def SundayInstallPipeline(): print '' print '' print '-----------------------------------------------------------------------------------------' print 'INFO: Installing Sunday Pipeline (Maya) Public aka SPMP - Version: ' + str(SundayInstallPipelineVersion()) print 'NOTE: Ignore the Runtime Warning if this is the initial install. Auto-Update should not throw any warnings.' print '-----------------------------------------------------------------------------------------' print 'Progress:' if ( cmds.pluginInfo( 'SundayPluginPublic.py', query=True, loaded=True) ): print 'INFO: Unloading existing SPMP Plugin' cmds.unloadPlugin( 'SundayPluginPublic.py' ) print '-----------------------------------------------------------------------------------------' print 'INFO: Create pipeline file structure - SundayPipeline directory' mayaAppDir = mel.eval('getenv MAYA_APP_DIR') pluginFilePath = mayaAppDir + '/' + 'plug-ins' print 'INFO: Plugin Path : ' + pluginFilePath sundayInstallPath = mayaAppDir + '/' + 'SundayPipeline' print 'INFO: Pipeline Path : ' + sundayInstallPath print 'INFO: Removing old/current SPMP Plugin if it exists' if os.path.exists(pluginFilePath + '/' + 'SundayPluginPublic.py'): print 'INFO: SPMP plugin found, removing it' os.remove(pluginFilePath + '/' + 'SundayPluginPublic.py') else: try: print 'INFO: Plugin direcotry not found, creating it : ' + pluginFilePath os.mkdir(pluginFilePath) except: print 'INFO: Plugin directory already exists : ' + pluginFilePath pass print 'INFO: Maya plugin path is set to : ' + pluginFilePath print 'INFO: Removing old/current SPMP Plugin if it exists' if os.path.exists(pluginFilePath + '/' + 'SundayPluginPublic.py'): print 'INFO: SPMP plugin found, removing it' os.remove(pluginFilePath + '/' + 'SundayPluginPublic.py') else: try: print 'INFO: Plugin direcotry not found, creating it : ' + pluginFilePath os.mkdir(pluginFilePath) except: print 'INFO: Plugin directory already exists : ' + pluginFilePath pass if (os.path.isdir(sundayInstallPath) != True): print 'INFO: Pipeline directory not found, creating it' os.mkdir(sundayInstallPath) else: print 'INFO: Pipeline directory found, cleaning it' shutil.rmtree(sundayInstallPath) os.mkdir(sundayInstallPath) print 'INFO: Downloading plugin zip file' try: pluginFile = os.path.join(pluginFilePath, 'plugin.zip') open(pluginFile, 'wb').write(urllib2.urlopen('http://3dg.dk/sundaypipeline/mayapublic/plugin.zip').read()) print 'INFO: Extracting plugin to : ' + pluginFilePath zipfile.ZipFile(pluginFile).extractall(pluginFilePath) except: print 'ERROR: Plugin download or extract failed' print 'INFO: Downloading pipeline zip file' try: pipelineFile = os.path.join(sundayInstallPath, 'pipeline.zip') open(pipelineFile, 'wb').write(urllib2.urlopen('http://3dg.dk/sundaypipeline/mayapublic/pipeline.zip').read()) print 'INFO: Extracting pipeline to : ' + sundayInstallPath zipfile.ZipFile(pipelineFile).extractall(sundayInstallPath) except: print 'ERROR: Pipeline download or extract failed' print 'INFO: Removing plugin and resources zip files' try: os.remove(pluginFile) os.remove(pipelineFile) except: print 'ERROR: Removing plugin and resources zip files failed. Check file permissions or try to delete manually' print 'INFO: Removing __MACOSX hidden files if exists' if os.path.exists(pluginFilePath + '/' + '__MACOSX'): shutil.rmtree(pluginFilePath + '/' + '__MACOSX') shutil.rmtree(sundayInstallPath + '/' + '__MACOSX') print 'INFO: Sunday Pipeline (Maya) Public Installed' print '-----------------------------------------------------------------------------------------' print 'INFO: Load SPMP plugin ' try: cmds.loadPlugin( 'SundayPluginPublic.py' ) cmds.pluginInfo( 'SundayPluginPublic.py', edit=True, autoload=True) print 'INFO: Sunday menu should now be visible :)' except: print 'ERROR: Loading SPMP plugin failed. Try loading manually or reinstall' print '-----------------------------------------------------------------------------------------' print '' print '' ####################################################################################################

Like? Social!

[social4i size=”large”]

7 Responses to Sunday Pipeline (Maya) – Install and Update Python Source Code

  • Alkeksandar

    This is great plugin, its make my life a lot easier.
    But its not working on Maya 2014, is it some update or something else?

  • cesartaqui

    Hi! It just works with .ma our works with .mb and ma files.
    Thanks!
    P.S Great Work Man.
    César Paiva
    Brasil 2012

  • Markus

    Thanks for the reply! I’ll test that out as soon as possible.

  • cea

    I have updated the script on December 7, 2011. Now it has a much better way to put the plugin file(s).

    @Dan. The script should run on Linux. It’s the same script that is used in the Sunday Pipeline (Maya) and I believe you are already have that up and running at Absolute Post? But write if you have any problems. I’m going test it soon on Linux :)

  • dan

    Will this run on linux?
    I’ve tried the script and manual install but both times it crashes with no warning.
    Interested in running it here at absolute post.

    Thanks

  • Markus

    Hi!
    Nice plugin, thanks for making it public!
    Thanks for the code, too. But it would help to get an correctly formatted .py file. The code indentation gets messed up when I just copy and paste from this website.
    What I want to do, btw, is change the installation dir for the plugin, because the method with reading the first part of the MAYA_PLUG_IN_PATH is very inconsistent and installs the plugin to almost random locations if you have that variable already modified.

    • cea

      Hi Markus

      Thanks for you comment. I have realized that the script doesn’t get the “maya plugin path” the moth intelligent way but I haven’t got around to post an update. If you have other plugins, like Renderman, installed the script above gets a wrong plugin path.
      EDIT: A better solution has been posted + a direct download button for the latest version I use in the pipeline.

Leave a Reply

Your email address will not be published. Required fields are marked *