LPCBeremiz.py
changeset 503 4c0cd5e54e1b
parent 501 d7bf56b036a8
child 510 8038c08b9874
equal deleted inserted replaced
502:5343ae43f6d0 503:4c0cd5e54e1b
     1 #!/usr/bin/env python
     1 #!/usr/bin/env python
     2 # -*- coding: utf-8 -*-
     2 # -*- coding: utf-8 -*-
       
     3 import shutil
     3 
     4 
     4 __version__ = "$Revision$"
     5 __version__ = "$Revision$"
     5 
     6 
     6 import os, sys, getopt, wx, tempfile
     7 import os, sys, getopt, wx, tempfile
     7 from types import TupleType, StringType, UnicodeType
     8 from types import TupleType, StringType, UnicodeType
   345     for i in os.listdir(src):
   346     for i in os.listdir(src):
   346         if not i.startswith('.'):
   347         if not i.startswith('.'):
   347             srcpath = os.path.join(src,i)
   348             srcpath = os.path.join(src,i)
   348             dstpath = os.path.join(dst,i)
   349             dstpath = os.path.join(dst,i)
   349             if os.path.isdir(srcpath):
   350             if os.path.isdir(srcpath):
   350                 if not os.path.exists(dstpath):
   351                 if os.path.exists(dstpath):
   351                     os.makedirs(dstpath)
   352                     shutil.rmtree(dstpath)
       
   353                 os.makedirs(dstpath)
   352                 mycopytree(srcpath, dstpath)
   354                 mycopytree(srcpath, dstpath)
   353             elif os.path.isfile(srcpath):
   355             elif os.path.isfile(srcpath):
   354                 shutil.copy2(srcpath, dstpath)
   356                 shutil.copy2(srcpath, dstpath)
   355 
   357 
   356 class LPCPluginsRoot(PluginsRoot):
   358 class LPCPluginsRoot(PluginsRoot):
   417             if self.SimulationBuildPath is None:
   419             if self.SimulationBuildPath is None:
   418                 self.SimulationBuildPath = os.path.join(tempfile.mkdtemp(), os.path.basename(self.ProjectPath), "build")
   420                 self.SimulationBuildPath = os.path.join(tempfile.mkdtemp(), os.path.basename(self.ProjectPath), "build")
   419             return self.SimulationBuildPath
   421             return self.SimulationBuildPath
   420         else:
   422         else:
   421             return PluginsRoot._getBuildPath(self)
   423             return PluginsRoot._getBuildPath(self)
       
   424 
       
   425     def _build(self):
       
   426         if self.BuildPath is not None:
       
   427             mycopytree(self.OrigBuildPath, self.BuildPath)
       
   428         PluginsRoot._build(self)
   422     
   429     
   423     def SetProjectName(self, name):
   430     def SetProjectName(self, name):
   424         return self.Project.setname(name)
   431         return self.Project.setname(name)
   425 
   432 
   426     def SetOnlineMode(self, mode, path=None):
   433     def SetOnlineMode(self, mode, path=None):
   512         
   519         
   513         # Keep track of the root plugin (i.e. project path)
   520         # Keep track of the root plugin (i.e. project path)
   514         self.ProjectPath = ProjectPath
   521         self.ProjectPath = ProjectPath
   515         
   522         
   516         self.BuildPath = self._getBuildPath()
   523         self.BuildPath = self._getBuildPath()
       
   524         self.OrigBuildPath = BuildPath
   517         if BuildPath is not None:
   525         if BuildPath is not None:
   518             mycopytree(BuildPath, self.BuildPath)
   526             mycopytree(BuildPath, self.BuildPath)
   519         
   527         
   520         # If dir have already be made, and file exist
   528         # If dir have already be made, and file exist
   521         if os.path.isdir(self.PlugPath()) and os.path.isfile(self.PluginXmlFilePath()):
   529         if os.path.isdir(self.PlugPath()) and os.path.isfile(self.PluginXmlFilePath()):