Example #1
0
 def __call__(self,
              source_filenames,
              strip_dir=0,
              output_dir=''):
     if output_dir is None:
         output_dir = ''
     obj_names = []
     sd = fullsplit(self.ext.source_directory)
     NB = len(sd)
     for src_name in source_filenames:
         # use normcase to make sure '.rc' is really '.rc' and not '.RC'
         (base, ext) = os.path.splitext (os.path.normcase(src_name))
         base = tuple(fullsplit(base)[NB:])
         base = os.path.join(self.ext.name,*base)
         if ext not in (self.compiler.src_extensions + ['.rc','.res']):
             raise UnknownFileError, \
                     "unknown file type '%s' (from '%s')" % \
                     (ext, src_name)
         if strip_dir:
             base = os.path.basename (base)
         if ext == '.res' or ext == '.rc':
             # these need to be compiled to object files
             obj_names.append (os.path.join (output_dir,
                                             base + ext + self.compiler.obj_extension))
         else:
             obj_names.append (os.path.join (output_dir,
                                             base + self.compiler.obj_extension))
     return obj_names
Example #2
0
 def create_package(self, dirpath):
     projectIndex = len(utils.fullsplit(PROJECT_PATH))
     pkgpath = os.path.join("prymatex", *utils.fullsplit(dirpath)[ projectIndex + 1: ])
     if not os.path.exists(pkgpath):
         os.makedirs(pkgpath)
     init = os.path.join(pkgpath, '__init__.py')
     if not os.path.isfile(init):
         f = open(init, 'w')
         f.flush()
         f.close()
Example #3
0
 def compile_ui(self, ui_file, py_file = None):
     """Compile the .ui files to python modules."""
     # Search for pyuic4 in python bin dir, then in the $Path.
     if py_file is None:
         projectIndex = len(utils.fullsplit(PROJECT_PATH))
         py_path = os.path.join(PROJECT_PATH, 'prymatex', *utils.fullsplit(ui_file)[projectIndex + 1:-1])
         py_file = os.path.split(ui_file)[1]
         py_file = os.path.splitext(py_file)[0] + '.py'
         py_file = os.path.join(py_path, py_file)
         
     if has_been_updated(ui_file, py_file) or self.force:
         if self.verbose:
             print(("Compiling %s -> %s" % (ui_file, py_file)))
         self._ui2py(ui_file, py_file)
     elif self.verbose > 1:
         print(("%s has not been modified" % ui_file))