Menu

Automating Pydev Workbench Creation

Gal Aviel
2009-03-15
2013-03-15
  • Gal Aviel

    Gal Aviel - 2009-03-15

    Hi All,

    I need to somehow automate the process of creating a pre-configured workspace for multiple users.

    We use pydev extensions extensively (we purchased a site license). The single project that the
    eclipse workspace should contain is a pydev one; and it should point to exactly one external directory.

    Both the directory names for the eclipse workspace as well as external (checked-out from SVN) source directory are encoded with the name of the user + the project name the user is working on (I'm thinking of writing a small wxPython GUI to grab these 2 pieces of information from the user and prepare
    everything; checkout and eclipse workspace creation (which points to the fresh, user+project encoded directory, that was just checked-out).

    I've tried to take an existing/working Eclipse workbench, and using 'grep' search and replace the
    username and project name, cp -R to new workspace, and try to open it, but it keeps reffering to the
    old location. I've noticed some binary files are involved.

    My question: how/if can I automate the above process?

    Any help would be greatly appreciated,

    Gal.

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2009-03-16

      Hi,

      Well, it's surely possible...

      Which information is pointing to the old location? Maybe it's easier to to just create the project with the .pydevproject settings correct and let Pydev recreate the needed settings (so, create the workspace without copying anything from org.python.pydev* or com.python.pydev*

      Another way (if you're familiar with Eclipse) might be creating a plugin where the user sets the basic information needed and it goes on to create the structure with access to the Eclipse/Pydev APIs.

      Cheers,

      Fabio

       
      • Gal Aviel

        Gal Aviel - 2009-03-16

        Hi Fabio,

        Thanks for your reply! this issue is really important to us.

        My best shot right now it seems is your first suggestion, since the 2nd one- I am not too familiar with Eclipse programming  right now and the learning curve is probably very high (although probably
        very interesting and useful).

        Would you say that a workspace with the following files is enough?
        I've tried this approach but when opening eclispe and choosing this workspace, no project is present,
        I get the Eclipse welcome screen.

        The minimal workspace :

        ./.metadata
        ./.metadata/.plugins
        ./.metadata/version.ini
        ./masada_tests
        ./masada_tests/.project
        ./masada_tests/.pydevproject

        The content of  .project which I've modified (xxx stand for the user name, will be replaced by
        automation script at runtime, project name in this case is masada) :

        <?xml version="1.0" encoding="UTF-8"?>
        <projectDescription>
            <name>masada_tests</name>
            <comment></comment>
            <projects>
            </projects>
            <buildSpec>
                <buildCommand>
                    <name>org.python.pydev.PyDevBuilder</name>
                    <arguments>
                    </arguments>
                </buildCommand>
            </buildSpec>
            <natures>
                <nature>org.python.pydev.pythonNature</nature>
            </natures>
            <linkedResources>
                <link>
                    <name>xxx_masada_tests</name>
                    <type>2</type>
                    <location>C:/Documents and Settings/mvh_lab/My Documents/xxx_masada_tests</location>
                </link>
            </linkedResources>
        </projectDescription>

        The content of .pydevproject :

        <?xml version="1.0" encoding="UTF-8"?>
        <?eclipse-pydev version="1.0"?>

        <pydev_project>
        <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
        <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
        <path>/masada_tests/xxx_masada_tests/python_generic</path>
        <path>/masada_tests/xxx_masada_tests/python_project_specific</path>
        <path>/masada_tests/xxx_masada_tests/vp_model_project_specific</path>
        </pydev_pathproperty>
        </pydev_project>

        Basically I'm trying to automate all the steps from creating new blank workspace to
        complete, ready to run : (1) pointing to Python.exe (2) starting new Pydev project  (3) add
        external folder to project (4) add dir's under external folder to PYTHONPATH.
        I want everything to be ready for the user.

        Any help would be much appreciated,

        TIA, Gal.

         
        • Brandon

          Brandon - 2009-03-16

          Hey,

          If you get this working I would be very interested to see the final product...we use PyDev a lot around here too...we have a little installer that will setup our framework already...it would be awesome to add this in there as well. thanks,

          -Brandon

           
        • Fabio Zadrozny

          Fabio Zadrozny - 2009-03-17

          I've been thinking a bit about it, and I think that the 'right way' to do it is creating an Eclipse plugin...

          I can give you a sample code to create/configure the interpreter and create/configure the project (that's straightforward to do -- when you know where to look for), so, you just need to create an action or wizard to do it (so, the user would only need to push a button to make it happen... So, you'd only need some really basic knowledge on how to create a plugin (should be pretty easy to do that)

          What do you think?

          Cheers,

          Fabio

           
          • Gal Aviel

            Gal Aviel - 2009-03-18

            Hi Fabio,

            How much time do you estimate it can take to generate this plug-in, assuming I don't have
            any Java or Eclipse programming experience? what would be the way to go ?
            something like http://www.eclipse.org/articles/Article-PDE-does-plugins/PDE-intro.html ?

            If it's more than 2-3 days, how painful would it be to go with an "ugly but working" approach (manually editing the .pydev project etc files, etc) and will it save me some time?

            I think the code you mention (to configure the interperter, etc) is worth while posting in any event
            because I think many of the people that are buying a site license would want to automate workspace creation for their teams.

            TIA, Gal.

             
            • Fabio Zadrozny

              Fabio Zadrozny - 2009-03-21

              Hi, sorry for the delay in getting back to you... Were you able to make it work?

              The thing is that I'm not sure that the 'dirty' approach will work correctly (especially among versions).

              I don't know how much time it'll take without any expertise in the area (I know it'd take me about 1 day to do it 'right').

              I'll add some easier APIs for that anyways (for 1.4.5).

              Cheers,

              Fabio

               
              • Brandon

                Brandon - 2009-03-21

                >>I'll add some easier APIs for that anyways (for 1.4.5).

                Great! I was going to try something out today with this but if you will make some APIs I will wait for that...thanks

                 
              • Gal Aviel

                Gal Aviel - 2009-03-22

                Hi Fabio,

                I was not able to make it work using .pydev etc files. The workspace keeps opening up with no
                projects defined.

                I'm staying tuned for the API you mentioned.

                Thanks again, Gal.

                 
          • Gal Aviel

            Gal Aviel - 2009-03-22

            Hi Fabio,

            How much time do you estimate it can take to generate this plug-in, assuming I don't have
            any Java or Eclipse programming experience? what would be the way to go ?
            something like http://www.eclipse.org/articles/Article-PDE-does-plugins/PDE-intro.html ?

            If it's more than 2-3 days, how painful would it be to go with an "ugly but working" approach (manually editing the .pydev project etc files, etc) and will it save me some time?

            I think the code you mention (to configure the interperter, etc) is worth while posting in any event
            because I think many of the people that are buying a site license would want to automate workspace creation for their teams.

            TIA, Gal.