Esempio n. 1
0
    def make(self):
        self.enterSourceDir()
        if self.buildType() == "Debug":
            bt = "Debug"
        else:
            bt = "Release"

        datafile = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                "icudt55l.dat")
        if os.path.exists(datafile):
            datafileDestination = os.path.join(self.sourceDir(), "data", "in",
                                               "icudt55l.dat")
            if os.path.exists(datafileDestination):
                os.remove(datafileDestination)
            utils.copyFile(datafile, datafileDestination)

        toolsetSwitches = ""
        if compiler.isMSVC2012():
            toolsetSwitches = "/property:PlatformToolset=v110"
        elif compiler.isMSVC2013():
            toolsetSwitches = "/tv:12.0 /property:PlatformToolset=v120"
        elif compiler.isMSVC2015():
            toolsetSwitches = "/tv:14.0 /property:PlatformToolset=v140"

        return utils.system(
            "msbuild /m /t:Rebuild \"%s\" /p:Configuration=%s %s" %
            (os.path.join(self.sourceDir(), "allinone",
                          "allinone.sln"), bt, toolsetSwitches))
Esempio n. 2
0
    def install( self ):
        targets = 'install_qmake install_mkspecs'
        for target in ['winmain', 'uic', 'moc', 'rcc', 'corelib', 'gui', 'xml', 'network']:
            targets += ' sub-%s-install_subtargets' % target

        if not QMakePackageBase.install(self, targets):
            return False

        # create qt.conf
        utils.copyFile( os.path.join( self.packageDir(), "qt.conf" ), os.path.join( self.installDir(), "bin", "qt.conf" ) )

        # at least in qt 4.5.2 the default mkspecs is not installed which let qmake fail with "QMAKESPEC has not been set, so configuration cannot be deduced."
        default_mkspec = os.path.join(self.installDir(), "mkspecs", "default")
        if not os.path.exists(default_mkspec):
            utils.copySrcDirToDestDir( os.path.join(self.buildDir(), "mkspecs", "default"), default_mkspec )

        # install msvc debug files if available
        if self.buildType() == "Debug" and (self.compiler() == "msvc2005" or self.compiler() == "msvc2008"):
            srcdir = os.path.join( self.buildDir(), "lib" )
            destdir = os.path.join( self.installDir(), "lib" )

            filelist = os.listdir( srcdir )

            for file in filelist:
                if file.endswith( ".pdb" ):
                    utils.copyFile( os.path.join( srcdir, file ), os.path.join( destdir, file ) )

        return True
Esempio n. 3
0
    def writeToFile(self, path):
        out = open(path, "w")

        utils.copyFile(PrologueFile, out)
        out.write(str(self.data))

        if RuntimeDebug:
            print >> out, "static size_t testCount;"

        print >> out, """
static Result
runTests(const Byte* buf, size_t len, const char** mime)
{
    Result rslt;
    Bool   haveError = False;
""",

        out.write(str(self.decls))
        out.write(str(self.code))

        print >> out, """

    if (haveError)
    {
        // nothing matched, perhaps because of the error
        return Error;
    }
    return Fail;
}

"""
        utils.copyFile(EpilogueFile, out)
        out.close()
Esempio n. 4
0
def createSystemFiles(serie):
    print(f"Creating system files for {serie}...")
    system_serie = system_dest_path / f"STM32{serie}xx"
    createFolder(system_serie)
    # Generate stm32yyxx_hal_conf_file.h
    stm32_hal_conf_file = system_serie / stm32yyxx_hal_conf_file.replace(
        "yy", serie.lower())
    out_file = open(stm32_hal_conf_file, "w", newline="\n")
    out_file.write(stm32yyxx_hal_conf_file_template.render(serie=serie))
    out_file.close()
    # Copy system_stm32*.c file from CMSIS device template
    system_stm32_path = cmsis_dest_path / f"STM32{serie}xx" / "Source" / "Templates"
    filelist = sorted(system_stm32_path.glob("system_stm32*.c"))
    file_number = len(filelist)
    if file_number:
        if file_number == 1:
            file_number = 0
        else:
            menu_list = "Several system stm32 files exist:\n"
            for index, fp in enumerate(filelist):
                menu_list += f"{index}. {fp.name}\n"
            menu_list += "Your choice: "
            while file_number >= len(filelist):
                file_number = int(input(menu_list))
        copyFile(filelist[file_number], system_serie)
    else:
        print("No system files found!")
    # Copy stm32yyxx_hal_conf_default.h file
    hal_conf_base = f"stm32{serie.lower()}xx_hal_conf"
    hal_serie_path = hal_dest_path / f"STM32{serie}xx_HAL_Driver"
    hal_conf_file = hal_serie_path / "Inc" / f"{hal_conf_base}_template.h"
    hal_conf_default = system_serie / f"{hal_conf_base}_default.h"
    copyFile(hal_conf_file, hal_conf_default)
def run(paths):
    src, out = paths
    if not os.path.exists(out):
        img = cv2.imread(src)
        img = cv2.resize(img, (255, 255))
        bbox, _ = model.detect(img, threshold=0.5, scale=1.0)
        
        if len(bbox) > 0:
            try:
                if CROP_FACES:
                    if DUPLICATE:
                        if MOVE_IMGS:
                            shutil.move(src, out)
                        else:
                            utils.copyFile(src, out)
                        
                    for ith_face, box in enumerate(bbox): 
                        x,y,w,h,_ = list(map(int, box))
                        imgCrop = img[y:y+h,x:x+w]
                        if not imgCrop.empty():
                            out += f"face_{str(ith_face)}.jpg"
                            cv2.imwrite(out, imgCrop)
                
                if MOVE_IMGS:
                    shutil.move(src, out)
                else:
                    utils.copyFile(src, out)
                # utils.write("Filtered images: {} | Saved images percentage:  {}".format(num_imgs_filtered, saved_imgs_percentage))
            except Exception as e:
                utils.write(str(e))
    else:
        utils.write("ALREADY_EXISTS")
Esempio n. 6
0
def updateBleLibrary():
    if upargs.local:
        cube_path = local_cube_path
    else:
        cube_name = f"{repo_generic_name}WB"
        cube_path = repo_local_path / cube_name
    ble_path = repo_local_path / repo_ble_name / "src" / "utility" / "STM32Cube_FW"
    cube_version = cube_versions["WB"]

    ble_commit_msg = f"Update STM32Cube_FW from Cube version {cube_version}"

    for file in ble_file_list:
        file_path = Path(cube_path / file)
        file_name = file_path.name
        if file_path.exists:
            # copy each file to destination
            if not Path(ble_path / file_name).parent.exists():
                Path(ble_path / file_name).parent.mkdir(parents=True)
            if file_name == "app_conf.h":
                # rename app_conf.h to app_conf_default.h
                copyFile(file_path, ble_path / "app_conf_default.h")
            else:
                copyFile(file_path, ble_path / file_name)
        else:
            print(f"File : {file_path} not found")
            print("Abort")
            sys.exit()

    updateBleReadme(ble_path / "README.md", cube_version)

    # Commit all BLE files
    commitFiles(ble_path, ble_commit_msg)

    # Apply BLE Arduino specific patch
    applyBlePatch()
Esempio n. 7
0
    def createPortablePackage( self ):
        """create portable 7z package with digest files located in the manifest subdir"""

        if not self.packagerExe:
            utils.die("could not find 7za in your path!")

        if self.package.endswith( "-package" ):
            shortPackage = self.package[ : -8 ]
        else:
            shortPackage = self.package


        if not "setupname" in self.defines or not self.defines[ "setupname" ]:
            self.defines[ "setupname" ] = shortPackage
            if self.subinfo.options.package.withArchitecture:
                    self.defines[ "setupname" ]  += "-" + os.getenv("EMERGE_ARCHITECTURE")
            self.defines[ "setupname" ]  += "-" + self.buildTarget + ".7z" 
        if not "srcdir" in self.defines or not self.defines[ "srcdir" ]:
            self.defines[ "srcdir" ] = self.imageDir()
        for f in self.scriptnames:
            utils.copyFile(f,os.path.join(self.defines[ "srcdir" ],os.path.split(f)[1]))
            
        # make absolute path for output file
        if not os.path.isabs( self.defines[ "setupname" ] ):
            dstpath = self.packageDestinationDir()
            self.defines[ "setupname" ] = os.path.join( dstpath, self.defines[ "setupname" ] )

        utils.deleteFile(self.defines[ "setupname" ])
        cmd = "cd %s && %s a -r %s %s" % (self.defines[ "srcdir" ], self.packagerExe,self.defines[ "setupname" ], '*')
        if not utils.system(cmd):
            utils.die( "while packaging. cmd: %s" % cmd )
Esempio n. 8
0
 def test_killProcess(self):
     # TODO: find a better test app than the cmd windows
     with tempfile.TemporaryDirectory() as tmp1:
         with tempfile.TemporaryDirectory() as tmp2:
             test1 = os.path.join(tmp1, "craft_test.exe")
             test2 = os.path.join(tmp2, "craft_test.exe")
             cmd = CraftCore.cache.findApplication("cmd")
             self.assertEqual(utils.copyFile(cmd, test1, linkOnly=False), True)
             self.assertEqual(utils.copyFile(cmd, test2, linkOnly=False), True)
             process = subprocess.Popen([test1,"/K"], creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
             process2 = subprocess.Popen([test2,"/K"], creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
             try:
                 self.assertEqual(process.poll(), None)
                 self.assertEqual(process2.poll(), None)
                 self.assertEqual(OsUtils.killProcess("craft_test", tmp2), True)
                 self.assertEqual(process.poll(), None)
                 #ensure that process 2 was killed
                 self.assertNotEquals(process2.poll(), None)
             except subprocess.SubprocessError as e:
                 CraftCore.log.warning(e)
             finally:
                 process.kill()
                 process2.kill()
                 process.wait()
                 process2.wait()
Esempio n. 9
0
    def make(self):
        self.enterSourceDir()
        if self.buildType() == "Debug":
            bt = "Debug"
        else:
            bt = "Release"

        datafile = os.path.join(os.path.dirname(os.path.abspath(__file__)), "icudt55l.dat")
        if os.path.exists(datafile):
            datafileDestination = os.path.join(self.sourceDir(), "data", "in", "icudt55l.dat")
            if os.path.exists(datafileDestination):
                os.remove(datafileDestination)
            utils.copyFile( datafile, datafileDestination)

        toolsetSwitches = ""
        if compiler.isMSVC2012():
            toolsetSwitches = "/property:PlatformToolset=v110"
        elif compiler.isMSVC2013():
            toolsetSwitches = "/tv:12.0 /property:PlatformToolset=v120"
        elif compiler.isMSVC2015():
            toolsetSwitches = "/tv:14.0 /property:PlatformToolset=v140"

        return utils.system("msbuild /m /t:Rebuild \"%s\" /p:Configuration=%s %s" %
                (os.path.join(self.sourceDir(), "allinone", "allinone.sln"), bt, toolsetSwitches)
        )
Esempio n. 10
0
def compileProject(prjPath, toPath):
    curWorkPath = os.getcwd()
    os.chdir(prjPath)

    key = "dhh"
    exclude_files = [
        "data.composite_effect_debug",
        #"module.net.rpc_lua_table"
    ]
    scripts = "/compile_scripts.bat"
    if sys.platform == "darwin":
        scripts = "compile_scripts.sh"

    cmds = [
        "%s/compile_scripts/%s" % (CUR_PATH, scripts),
        "-i %s" % prjPath,
        "-o %s" % toPath,
        "-x %s" % ",".join(exclude_files), "-m files", "-e xxtea_chunk",
        "-ek %s" % key
    ]
    os.system(" ".join(cmds))

    framework = os.path.join(CUR_PATH, "compile_impl",
                             "framework_precompiled.zip")
    utils.copyFile(
        framework, os.path.join(toPath, "gameobj",
                                "framework_precompiled.zip"))
    #pto_file = os.path.join("module", "net", "rpc_lua_table.lua")
    #utils.copyFile(pto_file, os.path.join(toPath, "module", "net", "rpc_lua_table.lua"))
    os.chdir(curWorkPath)
    return True
 def unpack(self):
     if not CMakePackageBase.unpack(self):
         return False
     if compiler.isMinGW32():
       if self.buildTarget in ['1.2.1', '1.2.3', '1.2.4', 'svnHEAD']:
           utils.copyFile( os.path.join(self.packageDir(), "wspiapi.h"),
                   os.path.join(self.buildDir(), "wspiapi.h") )
     return True
 def install(self):
     if not self.subinfo.defaultTarget == '1.44.0':
         for root, dirs, files in os.walk( os.path.join( portage.getPackageInstance( 'win32libs-bin',
                 'boost-headers' ).sourceDir(), "tools", "build", "v2", "engine" ) ):
             if "bjam.exe" in files:
                 utils.copyFile( os.path.join( root, "bjam.exe" ),
                                os.path.join( self.imageDir(), "bin", "bjam.exe" ) )
     return True
Esempio n. 13
0
 def install(self):
     if not AutoToolsPackageBase.install(self):
         return False
     files = os.listdir(os.path.join( self.installDir() , "lib" ))
     for dll in files:
         if dll.endswith(".dll"):
             utils.copyFile( os.path.join( self.installDir() , "lib" ,dll) , os.path.join( self.installDir(), "bin" ,dll) )
     return True
Esempio n. 14
0
    def run ( self ):
        print ( "Runnin' test\n" )

            ## Configuring
            ##
        super ( Test, self ).createTestEnvironment ()

        path_1 = super ( Test, self ).workspacePath ( "file_1.file" )
        path_2 = super ( Test, self ).workspacePath ( "file_2.file" )
        path_3 = super ( Test, self ).workspacePath ( "dir" )
        path_4 = super ( Test, self ).workspacePath ( "dir/file_4.file" )
        path_2t = super ( Test, self ).tempPath ( "file_2.file" )

            ## First pass
            ##
        try:
            self.startDetached ()
                ## Creatin' 32K file and smaller files
            utils.createFile ( path_1, 33 )
            utils.createFile ( path_2, 32768 )

            gc.collect ()
            print ( "XXX: " + str ( gc.garbage ) )
            time.sleep ( 1 )

            utils.checkFileSize ( path_1, 33 )
            utils.deleteFile ( path_1 )

                ## Copyin' files
            utils.checkFileSize ( path_2, 32768 )
            utils.copyFile ( path_2, path_2t )

                ## Directoryin' files
            # utils.createDirectory ( path_3 )
            # utils.copyFile ( path_2, path_4 )
            # utils.listDirectory ( super ( Test, self ).workspacePath ( "." ) )
            # time.sleep ( 1 )


            print ( "XXX: " + str ( gc.garbage ) )
            self.stopDetached ()
        except:
            print ( "XXX: " + str ( gc.garbage ) )
            self.stopDetached ()
            print ( "Error:" + str ( sys.exc_info () [ 0 ] ) )
            raise
            return

            ## Second pass
            ##
        try:
            self.startDetached ()

            self.stopDetached ()
        except:
            self.stopDetached ()
            print ( "Error:" + str ( sys.exc_info () [ 0 ] ) )
            return
Esempio n. 15
0
 def install(self):
     if not AutoToolsPackageBase.install(self):
         return False
     files = os.listdir(os.path.join(self.installDir(), "lib"))
     for dll in files:
         if dll.endswith(".dll"):
             utils.copyFile(os.path.join(self.installDir(), "lib", dll),
                            os.path.join(self.installDir(), "bin", dll))
     return True
Esempio n. 16
0
    def unpack( self ):
        if not BinaryPackageBase.unpack(self):
            return False

        files = ['cygz.dll','cygwin1.dll','cyggcc_s-1.dll','cyggmp-3.dll','cygmpfr-1.dll']
        srcDir = self.packageDir()
        destDir = "%s/opt/mingw32ce/arm-mingw32ce/bin" % self.installDir()
        for file in files:
            utils.copyFile(os.path.join(srcDir,file),os.path.join(destDir,file));
        return True
Esempio n. 17
0
    def configure( self ):
        self.enterSourceDir()
        
        utils.copyFile( os.path.join( self.packageDir(), "win32-msvc2010" ),
                        os.path.join( self.sourceDir(), "specs" ) )

        cmd = "python configure.py"
        cmd += self.subinfo.options.configure.defines
        os.system(cmd) and EmergeDebug.die("command: %s failed" % (cmd))
        return True
Esempio n. 18
0
    def install( self ):
        self.enterSourceDir()
        cmd = self.makeProgramm + " install"
        os.system(cmd) and EmergeDebug.die("command: %s failed" % cmd)
        
        # fix problem with not copying manifest file
        if not compiler.isMinGW():
            utils.copyFile( os.path.join( self.sourceDir(), "sipgen", "sip.exe.manifest" ),
                            sys.exec_prefix )

        return True
Esempio n. 19
0
    def install( self ):
        if self.isTargetBuild():
            # Configuring Qt for WinCE ignores the -prefix option,
            # so we have to do the job manually...

            # delete this because it is not working for windows
            utils.deleteFile( os.path.join( self.buildDir(), "plugin", "bearer", "qnmbearerd4.dll" ))
            utils.deleteFile( os.path.join( self.buildDir(), "plugin", "bearer", "qnmbearer4.dll" ))
            # syncqt expects qconfig.h to be in the install dir and fails if not
            utils.createDir( os.path.join( self.installDir(), "src", "corelib", "global") )
            utils.copyFile( os.path.join( self.buildDir(), "src", "corelib", "global", "qconfig.h" ), os.path.join( self.installDir(), "src", "corelib" , "global", "qconfig.h" ) )
            # headers need to be copied using syncqt because of the relative paths
            utils.prependPath(self.sourceDir(), "bin")
            command = os.path.join(self.sourceDir(), "bin", "syncqt.bat")
            command += " -base-dir \"" + self.sourceDir() + "\""
            command += " -outdir \"" + self.installDir() + "\""
            command += " -copy"
            command += " -quiet"
            utils.system( command )
            utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "bin" ) , os.path.join( self.installDir(), "bin" ) )
            utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "lib" ) , os.path.join( self.installDir(), "lib" ) )
            # the dlls must be copied to the bin dir too
            for file in os.listdir( os.path.join( self.installDir(), "lib" ) ):
                if file.endswith( ".dll" ):
                    utils.copyFile( os.path.join( self.installDir(), "lib" , file ), os.path.join( self.installDir(), "bin" , file ) )
            utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "mkspecs" ) , os.path.join( self.installDir(), "mkspecs" ) )
            utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "plugins" ) , os.path.join( self.installDir(), "plugins" ) )
            # create qt.conf
            utils.copyFile( os.path.join( self.packageDir(), "qt.conf" ), os.path.join( self.installDir(), "bin", "qt.conf" ) )
            return True

        if not QMakeBuildSystem.install(self):
            return False

        # Workaround QTBUG-12034
        utils.copySrcDirToDestDir( os.path.join( self.buildDir(), "plugins", "imageformats" ) ,
                                    os.path.join( self.installDir(), "bin", "imageformats" ) )

        # create qt.conf
        utils.copyFile( os.path.join( self.packageDir(), "qt.conf" ), os.path.join( self.installDir(), "bin", "qt.conf" ) )

        # install msvc debug files if available
        if self.buildType() == "Debug" and (self.compiler() == "msvc2005" or self.compiler() == "msvc2008" or self.compiler() == "msvc2010"):
            srcdir = os.path.join( self.buildDir(), "lib" )
            destdir = os.path.join( self.installDir(), "lib" )

            filelist = os.listdir( srcdir )

            for file in filelist:
                if file.endswith( ".pdb" ):
                    utils.copyFile( os.path.join( srcdir, file ), os.path.join( destdir, file ) )

        return True
Esempio n. 20
0
def newModule(mw, path):
    dlg = DlgNewObject(None, path, "module", "new.py", mw)
    result = dlg.exec()
    if result == QDialog.Accepted:
        mw.showMessage("Create module %s" % dlg.rname)
        if not os.path.isfile(dlg.rname):
            module = "resources/templates/newfiles/new.py"
            utils.copyFile(pkg_resources.resource_filename(__name__, module),
                           dlg.rname)
            mw.showMessage("New module %s created" % dlg.rname)
        else:
            mw.showMessage("Module %s already exists" % dlg.rname)
        openFile(mw, dlg.rname, "python")
Esempio n. 21
0
def newMDFile(mw, path):
    dlg = DlgNewObject(None, path, "MarkDown file", "new.md", mw)
    result = dlg.exec()
    if result == QDialog.Accepted:
        mw.showMessage("Create Markdown %s" % dlg.rname)
        if not os.path.isfile(dlg.rname):
            md = "resources/templates/newfiles/new.md"
            utils.copyFile(pkg_resources.resource_filename(__name__, md),
                           dlg.rname)
            mw.showMessage("New Markdown %s created" % dlg.rname)
        else:
            mw.showMessage("Markdown %s already exists" % dlg.rname)
        openFile(mw, dlg.rname, "md")
Esempio n. 22
0
def newQtUIFile(mw, path):
    dlg = DlgNewObject(None, path, "Qt UI file", "new.ui", mw)
    result = dlg.exec()
    if result == QDialog.Accepted:
        mw.showMessage("Create UI %s" % dlg.rname)
        if not os.path.isfile(dlg.rname):
            ui = "resources/templates/newfiles/new.ui"
            utils.copyFile(pkg_resources.resource_filename(__name__, ui),
                           dlg.rname)
            mw.showMessage("New Qt UI %s created" % dlg.rname)
        else:
            mw.showMessage("Qt UI %s already exists" % dlg.rname)
        openFile(mw, dlg.rname, "xml")
Esempio n. 23
0
def newSQLFile(mw, path):
    dlg = DlgNewObject(None, path, "SQL file", "new.sql", mw)
    result = dlg.exec()
    if result == QDialog.Accepted:
        mw.showMessage("Create SQL %s" % dlg.rname)
        if not os.path.isfile(dlg.rname):
            sql = "resources/templates/newfiles/new.sql"
            utils.copyFile(pkg_resources.resource_filename(__name__, sql),
                           dlg.rname)
            mw.showMessage("New SQL %s created" % dlg.rname)
        else:
            mw.showMessage("SQL %s already exists" % dlg.rname)
        openFile(mw, dlg.rname, "sql")
Esempio n. 24
0
 def install(self):
     if not AutoToolsPackageBase.cleanImage(self):
         return False
     os.makedirs(os.path.join(self.imageDir(), "bin"))
     os.makedirs(os.path.join(self.imageDir(), "lib"))
     os.makedirs(os.path.join(self.imageDir(), "include", "ghostscript"))
     utils.copyDir(os.path.join(self.sourceDir(), "sobin"), os.path.join(self.imageDir(), "bin"), False)
     utils.moveFile(
         os.path.join(self.imageDir(), "bin", "libgs.dll.a"), os.path.join(self.imageDir(), "lib", "libgs.dll.a")
     )
     utils.copyFile(
         os.path.join(self.sourceDir(), "psi", "iapi.h"),
         os.path.join(self.imageDir(), "include", "ghostscript", "iapi.h"),
         False,
     )
     utils.copyFile(
         os.path.join(self.sourceDir(), "psi", "ierrors.h"),
         os.path.join(self.imageDir(), "include", "ghostscript", "ierrors.h"),
         False,
     )
     utils.copyFile(
         os.path.join(self.sourceDir(), "devices", "gdevdsp.h"),
         os.path.join(self.imageDir(), "include", "ghostscript", "gdevdsp.h"),
         False,
     )
     utils.copyFile(
         os.path.join(self.sourceDir(), "base", "gserrors.h"),
         os.path.join(self.imageDir(), "include", "ghostscript", "gserrors.h"),
         False,
     )
     utils.copyDir(os.path.join(self.sourceDir(), "lib"), os.path.join(self.imageDir(), "lib"), False)
     return True
 def qmerge( self ):
     # When crosscompiling also install into the targets directory
     ret = CMakePackageBase.qmerge(self)
     if emergePlatform.isCrossCompilingEnabled():
         target_mimedir = os.path.join(ROOTDIR, emergePlatform.targetPlatform(),
                         "share", "mime", "packages")
         build_mime = os.path.join(self.imageDir(), "share", "mime",
                      "packages", "freedesktop.org.xml")
         utils.createDir(target_mimedir)
         if not os.path.exists(build_mime):
             utils.error("Could not find mime file: %s" % build_mime)
             return False
         utils.copyFile(build_mime, target_mimedir)
     return ret
Esempio n. 26
0
 def newQtUIFile(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "Qt UI file", "new.ui",
                               self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create UI %s" % dlg.rname)
         if not os.path.isfile(dlg.rname):
             ui = "resources/templates/newfiles/new.ui"
             utils.copyFile(pkg_resources.resource_filename(__name__, ui),
                            dlg.rname)
             self.parent.showMessage("New Qt UI %s created" % dlg.rname)
         else:
             self.parent.showMessage("Qt UI %s already exists" % dlg.rname)
         self.openFile(dlg.rname, "xml")
Esempio n. 27
0
 def install(self):
     if not AutoToolsPackageBase.cleanImage(self):
         return False
     os.makedirs(os.path.join(self.imageDir(), "bin"))
     os.makedirs(os.path.join(self.imageDir(), "lib"))
     os.makedirs(os.path.join(self.imageDir(), "include", "ghostscript"))
     utils.copyDir(os.path.join(self.sourceDir(), "sobin"),
                   os.path.join(self.imageDir(), "bin"), False)
     utils.moveFile(os.path.join(self.imageDir(), "bin", "libgs.dll.a"),
                    os.path.join(self.imageDir(), "lib", "libgs.dll.a"))
     utils.copyFile(
         os.path.join(self.sourceDir(), "psi", "iapi.h"),
         os.path.join(self.imageDir(), "include", "ghostscript", "iapi.h"),
         False)
     utils.copyFile(
         os.path.join(self.sourceDir(), "psi", "ierrors.h"),
         os.path.join(self.imageDir(), "include", "ghostscript",
                      "ierrors.h"), False)
     utils.copyFile(
         os.path.join(self.sourceDir(), "devices", "gdevdsp.h"),
         os.path.join(self.imageDir(), "include", "ghostscript",
                      "gdevdsp.h"), False)
     utils.copyFile(
         os.path.join(self.sourceDir(), "base", "gserrors.h"),
         os.path.join(self.imageDir(), "include", "ghostscript",
                      "gserrors.h"), False)
     utils.copyDir(os.path.join(self.sourceDir(), "lib"),
                   os.path.join(self.imageDir(), "lib"), False)
     return True
Esempio n. 28
0
 def newSQLFile(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "SQL file", "new.sql",
                               self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create SQL %s" % dlg.rname)
         if not os.path.isfile(dlg.rname):
             sql = "resources/templates/newfiles/new.sql"
             utils.copyFile(pkg_resources.resource_filename(__name__, sql),
                            dlg.rname)
             self.parent.showMessage("New SQL %s created" % dlg.rname)
         else:
             self.parent.showMessage("SQL %s already exists" % dlg.rname)
         self.openFile(dlg.rname, "sql")
Esempio n. 29
0
    def install(self):
        utils.copyDir(os.path.join(self.sourceDir(), "..", "bin"), os.path.join(self.imageDir(), "bin"))
        utils.copyDir(os.path.join(self.sourceDir(), "..", "bin64"), os.path.join(self.imageDir(), "bin"))
        utils.copyDir(os.path.join(self.sourceDir(), "..", "include"), os.path.join(self.imageDir(), "include"))
        utils.copyDir(os.path.join(self.sourceDir(), "..", "lib"), os.path.join(self.imageDir(), "lib"))
        utils.copyDir(os.path.join(self.sourceDir(), "..", "lib64"), os.path.join(self.imageDir(), "lib"))

        if compiler.isMSVC() and self.buildType() == "Debug":
            imagedir = os.path.join( self.installDir(), "lib" )
            filelist = os.listdir( imagedir )
            for f in filelist:
                if f.endswith( "d.lib" ):
                    utils.copyFile( os.path.join( imagedir, f ), os.path.join( imagedir, f.replace( "d.lib", ".lib" ) ) )

        return True
Esempio n. 30
0
 def dump(self, cacheFilePath):
     if os.path.isfile(cacheFilePath):
         try:
             with open(cacheFilePath, "rt+") as cacheFile:
                 cache = json.load(cacheFile)
         except:
             pass
         finally:
             if cache:
                 date = CraftManifest._parseTimeStamp(cache["date"])
             else:
                 date = datetime.datetime.utcnow()
             utils.copyFile(cacheFilePath, cacheFilePath + date.strftime("%Y%m%dT%H%M%S"), linkOnly=False)
     with open(cacheFilePath, "wt+") as cacheFile:
         json.dump(self, cacheFile, sort_keys=True, indent=2, default=lambda x:x.toJson())
Esempio n. 31
0
 def newMDFile(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "MarkDown file",
                               "new.md", self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create Markdown %s" % dlg.rname)
         if not os.path.isfile(dlg.rname):
             md = "resources/templates/newfiles/new.md"
             utils.copyFile(pkg_resources.resource_filename(__name__, md),
                            dlg.rname)
             self.parent.showMessage("New Markdown %s created" % dlg.rname)
         else:
             self.parent.showMessage("Markdown %s already exists" %
                                     dlg.rname)
         self.openFile(dlg.rname, "md")
Esempio n. 32
0
 def newModule(self):
     dlg = dialog.DlgNewObject(self.name, self.path, "module", "new.py",
                               self.parent)
     result = dlg.exec()
     if result == QDialog.Accepted:
         self.parent.showMessage("Create module %s" % dlg.rname)
         if not os.path.isfile(dlg.rname):
             module = "resources/templates/newfiles/new.py"
             utils.copyFile(
                 pkg_resources.resource_filename(__name__, module),
                 dlg.rname)
             self.parent.showMessage("New module %s created" % dlg.rname)
         else:
             self.parent.showMessage("Module %s already exists" % dlg.rname)
         self.openFile(dlg.rname, "python")
Esempio n. 33
0
    def promoteProject(self, folder):
        dialog = DlgPromoteProject(folder, self.parent)
        result = dialog.exec()
        if result == QDialog.Accepted:
            dirProject = dialog.txtProjectFolder.text()
            # Package folder
            package = dirProject
            print("PACKAGE=%s" % package)

            # Main module file
            module = dialog.cbxModuleName.currentText()

            # README.md
            if not os.path.isfile(os.path.join(package, "README.md")):
                readme = self.getReadme(dialog.txtProjectName.text(),
                                        dialog.txtAuthorName.text(),
                                        dialog.txtAuthorMail.text(),
                                        dialog.txtAuthorSite.text(),
                                        dialog.txtCompany.text(),
                                        dialog.cbxLicense.currentText())
                utils.copyStringToFile(readme,
                                       os.path.join(package, "README.md"))

            # LICENSE.md
            if not os.path.isfile(os.path.join(package, "LICENSE.md")):
                license = 'resources/templates/licenses/' + dialog.cbxLicense.currentText(
                ) + ".md"
                utils.copyFile(
                    pkg_resources.resource_filename(__name__, license),
                    os.path.join(package, "LICENSE.md"))

            # update members
            self.name = os.path.basename(os.path.normpath(dirProject))
            self.path = package

            # Encoding
            encoding = dialog.cbxEncoding.currentText()

            # Project file
            self.createXMLProjectFile(module, encoding)

            # Open project
            self.open()

            return True
        else:
            return False
Esempio n. 34
0
 def install(self):
     """ we have the whole logic here """
     imageEtcDir = os.path.join(self.imageDir(), "etc")
     installDBFile = os.path.join(imageEtcDir, "install.db")
     settingsFile = os.path.join(imageEtcDir, "kdesettings.ini")
     if os.path.exists(self.imageDir()):
         utils.cleanDirectory(self.imageDir())
     os.makedirs(imageEtcDir)
     # get the current installdb and the kdesettings.ini file
     utils.copyFile(os.path.join(EmergeStandardDirs.etcPortageDir(), "install.db"), installDBFile, linkOnly=False)
     utils.copyFile(os.path.join(EmergeStandardDirs.etcDir(), "kdesettings.ini"), settingsFile, linkOnly=False)
     self.resetSettings(settingsFile)
     self.db = InstallDB(installDBFile)
     self.removeCategoryFromDB("gnuwin32")
     self.removeCategoryFromDB("dev-util")
     # FIXME: the kdesettings file still contains packages that are not part of the frameworks sdk!!!
     return True
Esempio n. 35
0
    def install( self ):
        self.setPathes()
        if not Qt5CorePackageBase.install(self):
            return False
        utils.copyFile( os.path.join( self.buildDir(), "bin", "qt.conf"), os.path.join( self.imageDir(), "bin", "qt.conf" ) )
            
        # install msvc debug files if available
        if compiler.isMSVC():
            srcdir = os.path.join( self.buildDir(), "lib" )
            destdir = os.path.join( self.installDir(), "lib" )

            filelist = os.listdir( srcdir )

            for file in filelist:
                if file.endswith( ".pdb" ):
                    utils.copyFile( os.path.join( srcdir, file ), os.path.join( destdir, file ) )

        return True
Esempio n. 36
0
    def install(self):
        self.setPathes()
        if not Qt5CorePackageBase.install(self):
            return False
        utils.copyFile(os.path.join(self.buildDir(), "bin", "qt.conf"),
                       os.path.join(self.imageDir(), "bin", "qt.conf"))

        # install msvc debug files if available
        if compiler.isMSVC():
            srcdir = os.path.join(self.buildDir(), "lib")
            destdir = os.path.join(self.installDir(), "lib")

            filelist = os.listdir(srcdir)

            for file in filelist:
                if file.endswith(".pdb"):
                    utils.copyFile(os.path.join(srcdir, file),
                                   os.path.join(destdir, file))

        return True
def run(paths):
    src, out = paths
    if not os.path.exists(out):
        img = cv2.imread(src)
        img = cv2.resize(img, (255, 255))

        faces = []
        croppedImages = []

        for ith_face, box in enumerate(bbox):
            x, y, w, h, _ = list(map(int, box))
            imgCrop = img[y:y + h, x:x + w]
            croppedImages.append(imgCrop)
            face = cv2.cvtColor(imgCrop, cv2.COLOR_BGR2RGB)
            face = cv2.resize(face, (224, 224))
            face = img_to_array(face)
            face = preprocess_input(face)
            face = np.expand_dims(face, axis=0)
            faces.append(face)

            preds = maskNet.predict(faces)
            print(preds)
            saveImg = True
            if CROP_FACES:
                if DUPLICATE:
                    if MOVE_IMGS:
                        shutil.move(src, out)
                    else:
                        utils.copyFile(src, out)

                if not imgCrop.empty():
                    out += f"face_{str(ith_face)}.jpg"
                    cv2.imwrite(out, imgCrop)

            if MOVE_IMGS:
                shutil.move(src, out)
            else:
                utils.copyFile(src, out)
            utils.write(
                "Filtered images: {} | Saved images percentage:  {}".format(
                    num_imgs_filtered, saved_imgs_percentage))
Esempio n. 38
0
 def copyToMsvcImportLib(self):
     if not OsUtils.isWin():
         return True
     reDlla = re.compile(r"\.dll\.a$")
     reLib = re.compile(r"^lib")
     for f in glob.glob(f"{self.installDir()}/lib/*.dll.a"):
         path, name = os.path.split(f)
         name = re.sub(reDlla, ".lib", name)
         name = re.sub(reLib, "", name)
         if not utils.copyFile(f, os.path.join(path, name), linkOnly=False):
             return False
     return True
Esempio n. 39
0
 def unpack(self):
     if not BinaryPackageBase.unpack(self):
         return False
     utils.copyFile(os.path.join(self.packageDir(),"git.bat"),os.path.join(self.rootdir,"dev-utils","bin","git.bat"))
     utils.copyFile(os.path.join(self.packageDir(),"gb.bat"),os.path.join(self.rootdir,"dev-utils","bin","gb.bat"))
     utils.copyFile(os.path.join(self.packageDir(),"gitk.bat"),os.path.join(self.rootdir,"dev-utils","bin","gitk.bat"))
     return True
Esempio n. 40
0
    def install(self):
        utils.copyDir(os.path.join(self.sourceDir(), "..", "bin"),
                      os.path.join(self.imageDir(), "bin"))
        utils.copyDir(os.path.join(self.sourceDir(), "..", "bin64"),
                      os.path.join(self.imageDir(), "bin"))
        utils.copyDir(os.path.join(self.sourceDir(), "..", "include"),
                      os.path.join(self.imageDir(), "include"))
        utils.copyDir(os.path.join(self.sourceDir(), "..", "lib"),
                      os.path.join(self.imageDir(), "lib"))
        utils.copyDir(os.path.join(self.sourceDir(), "..", "lib64"),
                      os.path.join(self.imageDir(), "lib"))

        if compiler.isMSVC() and self.buildType() == "Debug":
            imagedir = os.path.join(self.installDir(), "lib")
            filelist = os.listdir(imagedir)
            for f in filelist:
                if f.endswith("d.lib"):
                    utils.copyFile(
                        os.path.join(imagedir, f),
                        os.path.join(imagedir, f.replace("d.lib", ".lib")))

        return True
Esempio n. 41
0
def CoypResAndCheckDiff(destPath,
                        platform,
                        isZipDiff=True,
                        useConfig=False,
                        isContinue=True):
    newPath = os.path.join(RES_PATH, platform, "new")
    oldPath = os.path.join(RES_PATH, platform, "old")
    srcPath = os.path.join(newPath, "resource")
    if not os.path.exists(srcPath):
        print("源文件目录%s不存在!!!" % srcPath)
        return

    diffPaths = checkDiff.checkFilelistDiff(newPath, oldPath)
    if os.path.exists(oldPath):
        #检查oldPath 是否已经已经发布过
        print("检查oldPath 是否已经已经发布过")
        isOk = CheckFilelistOnline(oldPath)
        print(isOk)
        if not isOk:
            if not useConfig:
                while (True):
                    printCn(u"上次的资源并没有分布过,是否要继续? Y or N ?")
                    inputStr = raw_input()
                    isContinue = (inputStr == "Y")
                    break
        if not isContinue:
            assert isOk, "检查oldPath 还没有发布过,很危险!!!!!!!"

    if len(diffPaths) > 0 and not os.path.exists(destPath):
        os.makedirs(destPath)

    if isZipDiff:
        for path in diffPaths:
            destFile = os.path.join(destPath, path)
            srcFile = os.path.join(srcPath, path)
            utils.copyFile(srcFile, destFile)
    else:
        res_manage.CopyEncodeResToNewPath(srcPath, destPath)
Esempio n. 42
0
 def install(self):
     """ we have the whole logic here """
     imageEtcDir = os.path.join(self.imageDir(), "etc")
     installDBFile = os.path.join(imageEtcDir, "install.db")
     settingsFile = os.path.join(imageEtcDir, "kdesettings.ini")
     if os.path.exists(self.imageDir()):
         utils.cleanDirectory(self.imageDir())
     os.makedirs(imageEtcDir)
     # get the current installdb and the kdesettings.ini file
     utils.copyFile(os.path.join(EmergeStandardDirs.etcPortageDir(),
                                 "install.db"),
                    installDBFile,
                    linkOnly=False)
     utils.copyFile(os.path.join(EmergeStandardDirs.etcDir(),
                                 "kdesettings.ini"),
                    settingsFile,
                    linkOnly=False)
     self.resetSettings(settingsFile)
     self.db = InstallDB(installDBFile)
     self.removeCategoryFromDB("gnuwin32")
     self.removeCategoryFromDB("dev-util")
     # FIXME: the kdesettings file still contains packages that are not part of the frameworks sdk!!!
     return True
 def install( self ):
     """install the target"""
     for root, dirs, files in os.walk( self.buildDir() ):
         for f in files:
             if f.endswith( ".dll" ):
                 utils.copyFile( os.path.join( root, f ),os.path.join( self.imageDir(), "lib", f ) )
                 utils.copyFile( os.path.join( root, f ),os.path.join( self.imageDir(), "bin", f ) )
             elif f.endswith( ".a" ) or f.endswith( ".lib" ):
                 utils.copyFile( os.path.join( root, f ), os.path.join( self.imageDir(), "lib", f ) )
     return True
Esempio n. 44
0
    def install( self ):
        """install the target"""
        if not BuildSystemBase.install(self):
            return False

        for root, dirs, files in os.walk( self.buildDir() ):
            for f in files:
                if f.endswith( ".dll" ):
                    utils.copyFile( os.path.join( root, f ),os.path.join( self.imageDir(), "lib", f ) )
                    utils.copyFile( os.path.join( root, f ),os.path.join( self.imageDir(), "bin", f ) )
                elif f.endswith( ".a" ) or f.endswith( ".lib" ):
                    utils.copyFile( os.path.join( root, f ), os.path.join( self.imageDir(), "lib", f ) )
        return True
    def copy_files(self):
        '''
            Copy the binaries for the Package from kderoot to the image
            directory
        '''
        wm_root = os.path.join(self.rootdir,
                os.environ["EMERGE_TARGET_PLATFORM"]) + os.path.sep
        utils.createDir(self.workDir())
        utils.debug("Copying from %s to %s ..." % (wm_root,
            self.workDir()), 1)
        uniquebasenames = []
        unique_names = []
        duplicates = []

        #FIXME do this in the gpg-wce-dev portage
        windir = os.path.join(wm_root, "windows")
        if not os.path.isdir(windir):
            os.mkdir(windir)
        libgcc_src = os.path.join(wm_root, "bin", "libgcc_s_sjlj-1.dll")
        libgcc_tgt = os.path.join(wm_root, "windows", "libgcc_s_sjlj-1.dll")
        utils.copyFile(libgcc_src, libgcc_tgt)

        for entry in self.traverse(wm_root, self.whitelisted):
            if os.path.basename(entry) in uniquebasenames:
                utils.debug("Found duplicate filename: %s" % \
                        os.path.basename(entry), 2)
                duplicates.append(entry)
            else:
                unique_names.append(entry)
                uniquebasenames.append(os.path.basename(entry))

        for entry in unique_names:
            entry_target = entry.replace(wm_root,
                    os.path.join(self.workDir()+"\\"))
            if not os.path.exists(os.path.dirname(entry_target)):
                utils.createDir(os.path.dirname(entry_target))
            shutil.copy(entry, entry_target)
            utils.debug("Copied %s to %s" % (entry, entry_target),2)
        dups=0
        for entry in duplicates:
            entry_target = entry.replace(wm_root,
                    os.path.join(self.workDir()+"\\"))
            entry_target = "%s_dup%d" % (entry_target, dups)
            dups += 1
            if not os.path.exists(os.path.dirname(entry_target)):
                utils.createDir(os.path.dirname(entry_target))
            shutil.copy(entry, entry_target)
            utils.debug("Copied %s to %s" % (entry, entry_target), 2)

        # Handle special cases
        pinentry = os.path.join(wm_root, "bin", "pinentry-qt.exe")
        utils.copyFile(pinentry, os.path.join(self.workDir(), "bin",
                "pinentry.exe"))

        #The Kolab icon is in hicolor but we only package oxygen for CE
        kolabicon = os.path.join(wm_root, "share", "icons", "hicolor",
                                 "64x64", "apps", "kolab.png")
        utils.copyFile(kolabicon, os.path.join(self.workDir(), "share",
                       "icons", "oxygen", "64x64", "apps", "kolab.png"))

        # Drivers need to be installed in the Windows direcotry
        gpgcedev = os.path.join(wm_root, "bin", "gpgcedev.dll")
        if not os.path.isdir(os.path.join(self.workDir(), "windows")):
            os.mkdir(os.path.join(self.workDir(), "windows"))
        utils.copyFile(gpgcedev, os.path.join(self.workDir(), "windows"))

        # Create an empty file for DBus and his /etc/dbus-1/session.d
        dbus_session_d = os.path.join(self.workDir(), "etc", "dbus-1",
                "session.d")
        if not os.path.exists(dbus_session_d): os.mkdir(dbus_session_d)
        f = open(os.path.join(dbus_session_d, "stub"), "w")
        f.close()
        # Rename applications that should be started by the loader
        for f in self.loader_executables:
            path2file = os.path.join(wm_root, f)
            if not os.path.isfile(path2file):
                utils.debug("Createloaderfiles: Could not find %s at %s " % \
                        (f, path2file))
                continue
            realpath = path2file.replace(f, os.path.splitext(f)[0] +
                    "-real.exe")
            shutil.copy(path2file, realpath.replace(wm_root,
                    os.path.join(self.workDir()+"\\")))
            customloader = path2file.replace(f, os.path.splitext(f)[0] +
                    "-loader.exe")
            defaultloader = os.path.join(wm_root, "bin", "himemce.exe")
            path2file = path2file.replace(wm_root,
                    os.path.join(self.workDir()+"\\"))
            if os.path.isfile(customloader):
                shutil.copy(customloader, path2file)
            elif os.path.isfile(defaultloader):
                shutil.copy(defaultloader, path2file)
            else:
                utils.die("Trying to use the custom loader but no loader \
found in: %s \n Please ensure that package wincetools is installed" %\
                os.path.join(wm_root, "bin"))
        # Add start menu icons to the Package
        for f in self.menu_icons:
            path2file = os.path.join(self.packageDir(), "icons", f)
            if os.path.isfile(path2file):
                utils.copyFile(path2file, os.path.join(self.workDir(),
                    "share", "icons"))
            else:
                utils.debug("Failed to copy %s not a file: %s" % path2file, 1)

        # Configure localization
        if self.buildTarget == 'de':
            confdir = os.path.join(self.workDir(), "share", "config")
            if not os.path.isdir(confdir):
                os.makedirs(confdir)
            with open(os.path.join(confdir, "kdeglobals"),"w") as f:
                f.write('[Locale]\n')
                f.write('Country=de\n')
                f.write('Language=de\n\n')
                f.write('[Spelling]\n')
                f.write('defaultLanguage=de_DE\n')

        # Configure GNUPG
        confdir = os.path.join(self.workDir(), "gnupg")
        if not os.path.isdir(confdir):
            os.makedirs(confdir)
        if os.getenv("EMERGE_PACKAGE_CUSTOM_LDAPSERVERS_CONF"):
            utils.copyFile(os.getenv("EMERGE_PACKAGE_CUSTOM_LDAPSERVERS_CONF"),
                    os.path.join(confdir, "ldapservers.conf"))
        else:
            utils.copyFile(os.path.join(self.packageDir(), "ldapservers-example.conf"),
                os.path.join(confdir, "ldapservers.conf"))

        # Add trustlist
#        if os.getenv("EMERGE_PACKAGE_CUSTOM_TRUSTLIST_TXT"):
#            utils.copyFile(os.getenv("EMERGE_PACKAGE_CUSTOM_TRUSTLIST_TXT"),
#                    os.path.join(confdir, "trustlist.txt"))
#        else:
#            utils.copyFile(os.path.join(self.packageDir(), "trustlist-example.txt"),
#                os.path.join(confdir, "trustlist.txt"))

        # Add certificates
        if os.getenv("EMERGE_PACKAGE_CUSTOM_ROOTCERTS"):
            confdir = os.path.join(self.workDir(), "gnupg", "trusted-certs")
            cpath = os.getenv("EMERGE_PACKAGE_CUSTOM_ROOTCERTS")
            if not os.path.isdir(confdir):
                os.mkdir(confdir)
            if not os.path.isdir(cpath):
                utils.die("EMERGE_PACKAGE_CUSTOM_ROOTCERTS set up invalid")
            for f in os.listdir(cpath):
                utils.copyFile(os.path.join(cpath, f), confdir)

        # Configure Strigi
        confdir = os.path.join(self.workDir(), "My Documents", ".strigi")
        if not os.path.isdir(confdir):
            os.makedirs(confdir)
        utils.copyFile(os.path.join(self.packageDir(), "daemon.conf"),
                       os.path.join(confdir, "daemon.conf"))

        # Locale information
        confdir = os.path.join(self.workDir(), "share", "locale", "l10n", "de")
        if not os.path.isdir(confdir):
            os.makedirs(confdir)
        # hack for duplicate file, there cannot be over 21000 files in the cab
        # so should be save
        utils.copyFile(os.path.join(self.packageDir(), "entry.desktop"),
                       os.path.join(confdir, "entry.desktop_dup99999999"))

        # Configure Kleopatra
        confdir = os.path.join(self.workDir(), "My Documents", ".kde",
                               "share", "config")
        if not os.path.isdir(confdir):
            os.makedirs(confdir)
            with open(os.path.join(confdir, "kleopatrarc"),"w") as f:
                f.write("[Self-Test]\n")
                f.write("run-at-startup=false\n\n")
                f.write("[CertificateCreationWizard]\n")
                f.write("DNAttributeOrder=CN!,EMAIL!\n")
      dirs = ['bin','pytel']
      for d in dirs:
         print '... now extracting ' + d
         pid = path.join(pt,d)
         if path.exists(pid) :
            po = pid.replace(pt,pc)
            createDirectories(po)
            copyFiles(pid,po)
            print '    +> '+pid

      pid = path.join(pt,'config')
      if path.exists(pid):
         po = pid.replace(pt,pc)
         createDirectories(po)
         copyFile(options.configFile,po)
         print '... finally copying ' + options.configFile

      print '\n... now packaging ' + cfgname
      zip(cfgname,pc,cfg['ZIPPER'])

      print '\n... now cleaning '
      removeDirectories(pc)

   if options.archiveName != '':
      print '\n... now packaging ' + cfgname + ' into ' + archive
      zip(path.basename(archive),archive,cfg['ZIPPER']) # /!\ use the last cfg value

      print '\n... now cleaning ' + archive
      removeDirectories(archive)
Esempio n. 47
0
    def configure( self, unused1=None, unused2=""):
        self.enterBuildDir()
        self.setPathes()

        xplatform = ""
        if self.isTargetBuild():
            if self.buildPlatform() == "WM60":
                xplatform = "wincewm60professional-%s" % self.compiler()
            elif self.buildPlatform() == "WM65":
                xplatform = "wincewm65professional-%s" % self.compiler()
            elif self.buildPlatform() == "WM50":
                xplatform = "wincewm50pocket-%s" % self.compiler()
            else:
                exit( 1 )

        os.environ[ "USERIN" ] = "y"
        userin = "y"

        incdirs = " -I \"" + os.path.join( self.dbus.installDir(), "include" ) + "\""
        libdirs = " -L \"" + os.path.join( self.dbus.installDir(), "lib" ) + "\""
        incdirs += " -I \"" + os.path.join( self.openssl.installDir(), "include" ) + "\""
        libdirs += " -L \"" + os.path.join( self.openssl.installDir(), "lib" ) + "\""
        if self.isTargetBuild():
            incdirs += " -I \"" + os.path.join( self.wcecompat.installDir(), "include" ) + "\""
            libdirs += " -L \"" + os.path.join( self.wcecompat.installDir(), "lib" ) + "\""
        if not emergePlatform.isCrossCompilingEnabled():
            incdirs += " -I \"" + os.path.join( self.mysql_server.installDir(), "include" ) + "\""
            libdirs += " -L \"" + os.path.join( self.mysql_server.installDir(), "lib" ) + "\""
            libdirs += " -l libmysql "
        else:
            utils.copyFile( os.path.join( self.packageDir(), "sources", "qconfig-kde-wince.h" ),
                    os.path.join( self.sourceDir(), "src", "corelib" , "global", "qconfig-kde-wince.h" ) )
            utils.copyFile( os.path.join( self.packageDir(), "sources", "new.cpp" ),
                    os.path.join( self.sourceDir(), "src", "corelib" , "global", "new.cpp" ) )
            utils.copyFile( os.path.join( self.packageDir(), "sources", "gpglogger_wince.cpp" ),
                    os.path.join( self.sourceDir(), "src", "corelib" , "global", "gpglogger_wince.cpp" ) )
            utils.copyFile( os.path.join( self.packageDir(), "sources", "gpglogger_wince.h" ),
                    os.path.join( self.sourceDir(), "src", "corelib" , "global", "gpglogger_wince.h" ) )

        configure = os.path.join( self.sourceDir(), "configure.exe" ).replace( "/", "\\" )
        command = r"echo %s | %s -opensource -prefix %s -platform %s " % ( userin, configure, self.installDir(), self.platform )
        if emergePlatform.isCrossCompilingEnabled():
            if self.isTargetBuild():
                command += "-xplatform %s -qconfig kde-wince " % xplatform
                command += "-no-exceptions -no-stl -no-rtti "
            if self.isHostBuild():
                command += "-no-xmlpatterns -no-declarative -no-opengl "
            command += "-no-qt3support -no-multimedia -no-scripttools -no-accessibility -no-libmng -no-libtiff -no-gif -no-webkit "

        if not emergePlatform.isCrossCompilingEnabled():
            # non-cc builds only
            command += "-plugin-sql-odbc -plugin-sql-mysql "
            command += "-qt-style-windowsxp -qt-style-windowsvista "
            command += "-qt-libpng -qt-libjpeg -qt-libtiff "

        # WebKit won't link properly with LTCG in a 32-bit MSVC environment
        if emergePlatform.buildArchitecture() == "x86" and compiler.isMSVC2008():
            command += "-no-ltcg "
        else:
            command += "-ltcg "

        # all builds
        command += "-no-phonon "
        command += "-qdbus -dbus-linked -openssl-linked "
        command += "-fast -no-vcproj -no-dsp "
        command += "-nomake demos -nomake examples "
        command += "%s %s" % ( incdirs, libdirs )

        if self.buildType() == "Debug":
          command += " -debug "
        else:
          command += " -release "
        print "command: ", command
        utils.system( command )
        return True
Esempio n. 48
0
    def install( self ):
        if not os.path.isdir( os.path.join( self.installDir() , "bin" ) ):
                os.makedirs( os.path.join( self.installDir() , "bin" ) )
        utils.copyFile(os.path.join( self.sourceDir(), 'dll', 'Win32', 'Release', 'mpir.dll'), os.path.join( self.installDir() , "bin" , "mpir.dll") )
        
        if not os.path.isdir( os.path.join( self.installDir() , "lib" ) ):
                os.makedirs( os.path.join( self.installDir() , "lib" ) )
        utils.copyFile(os.path.join( self.sourceDir(), 'dll', 'Win32', 'Release', 'mpir.lib'), os.path.join( self.installDir() , "lib" , "mpir.lib") )
        # a dirty workaround the fact that FindGMP.cmake will only look for gmp.lib
        utils.copyFile(os.path.join( self.installDir() , "lib" , "mpir.lib"), os.path.join( self.installDir() , "lib" , "gmp.lib") )

        if not os.path.isdir( os.path.join( self.installDir() , "include" ) ):
                os.makedirs( os.path.join( self.installDir() , "include" ) )
        utils.copyFile(os.path.join( self.sourceDir(), 'dll', 'Win32', 'Release', 'gmp.h'), os.path.join( self.installDir() , "include" , "gmp.h") )
        utils.copyFile(os.path.join( self.sourceDir(), 'dll', 'Win32', 'Release', 'gmpxx.h'), os.path.join( self.installDir() , "include" , "gmpxx.h") )
        utils.copyFile(os.path.join( self.sourceDir(), 'dll', 'Win32', 'Release', 'mpir.h'), os.path.join( self.installDir() , "include" , "mpir.h") )
        utils.copyFile(os.path.join( self.sourceDir(), 'dll', 'Win32', 'Release', 'mpirxx.h'), os.path.join( self.installDir() , "include" , "mpirxx.h") )
        utils.copyFile(os.path.join( self.sourceDir(), 'dll', 'Win32', 'Release', 'gmp-mparam.h'), os.path.join( self.installDir() , "include" , "gmp-mparam.h") )
        
        return True
Esempio n. 49
0
 def install( self ):
     if not BinaryPackageBase.install(self):
         return False
     utils.copyFile(os.path.join(self.packageDir(),"git.exe"),os.path.join(self.imageDir(),"bin","git.exe"))
     return True
Esempio n. 50
0
def backup():
    utils.copyFile(os.path.join( EmergeStandardDirs.etcPortageDir(), "install.db"), os.path.join( EmergeStandardDirs.etcPortageDir(), "install.db.backup"),linkOnly=False)
    utils.copyFile(os.path.join( EmergeStandardDirs.etcDir(), "kdesettings.ini"), os.path.join( EmergeStandardDirs.etcDir(), "kdesettings.ini.backup"),linkOnly=False)
Esempio n. 51
0
    def install(self):
        src = self.sourceDir()
        dst = self.imageDir()

        if not os.path.isdir(dst):
            os.mkdir(dst)
        if not os.path.isdir(os.path.join(dst, "bin")):
            os.mkdir(os.path.join(dst, "bin"))
        if not os.path.isdir(os.path.join(dst, "lib")):
            os.mkdir(os.path.join(dst, "lib"))
        if not os.path.isdir(os.path.join(dst, "include")):
            os.mkdir(os.path.join(dst, "include"))
        if not os.path.isdir(os.path.join(dst, "include", "ghostscript")):
            os.mkdir(os.path.join(dst, "include", "ghostscript"))

        if compiler.isX64():
            _bit = "64"
        else:
            _bit = "32"
        utils.copyFile(os.path.join(src, "bin", "gsdll%s.dll" % _bit),
                       os.path.join(dst, "bin"), False)
        utils.copyFile(os.path.join(src, "bin", "gsdll%s.lib" % _bit),
                       os.path.join(dst, "lib"), False)
        utils.copyFile(os.path.join(src, "bin", "gswin%s.exe" % _bit),
                       os.path.join(dst, "bin"), False)
        utils.copyFile(os.path.join(src, "bin", "gswin%sc.exe" % _bit),
                       os.path.join(dst, "bin"), False)
        utils.copyFile(
            os.path.join(self.sourceDir(), "psi", "iapi.h"),
            os.path.join(self.imageDir(), "include", "ghostscript", "iapi.h"),
            False)
        utils.copyFile(
            os.path.join(self.sourceDir(), "psi", "ierrors.h"),
            os.path.join(self.imageDir(), "include", "ghostscript",
                         "ierrors.h"), False)
        utils.copyFile(
            os.path.join(self.sourceDir(), "devices", "gdevdsp.h"),
            os.path.join(self.imageDir(), "include", "ghostscript",
                         "gdevdsp.h"), False)
        utils.copyFile(
            os.path.join(self.sourceDir(), "base", "gserrors.h"),
            os.path.join(self.imageDir(), "include", "ghostscript",
                         "gserrors.h"), False)
        utils.copyDir(os.path.join(self.sourceDir(), "lib"),
                      os.path.join(self.imageDir(), "lib"), False)

        return True
Esempio n. 52
0
    def install(self):
        src = self.sourceDir()
        dst = self.imageDir()

        if not os.path.isdir(dst):
            os.mkdir(dst)
        if not os.path.isdir(os.path.join(dst, "bin")):
            os.mkdir(os.path.join(dst, "bin"))
        if not os.path.isdir(os.path.join(dst, "lib")):
            os.mkdir(os.path.join(dst, "lib"))
        if not os.path.isdir(os.path.join(dst, "include")):
            os.mkdir(os.path.join(dst, "include"))
        if not os.path.isdir(os.path.join(dst, "include", "ghostscript")):
            os.mkdir(os.path.join(dst, "include", "ghostscript"))

        if compiler.isX64():
            _bit = "64"
        else:
            _bit = "32"
        utils.copyFile(os.path.join(src, "bin", "gsdll%s.dll" % _bit), os.path.join(dst, "bin"), False)
        utils.copyFile(os.path.join(src, "bin", "gsdll%s.lib" % _bit), os.path.join(dst, "lib"), False)
        utils.copyFile(os.path.join(src, "bin", "gswin%s.exe" % _bit), os.path.join(dst, "bin"), False)
        utils.copyFile(os.path.join(src, "bin", "gswin%sc.exe" % _bit), os.path.join(dst, "bin"), False)
        utils.copyFile(
            os.path.join(self.sourceDir(), "psi", "iapi.h"),
            os.path.join(self.imageDir(), "include", "ghostscript", "iapi.h"),
            False,
        )
        utils.copyFile(
            os.path.join(self.sourceDir(), "psi", "ierrors.h"),
            os.path.join(self.imageDir(), "include", "ghostscript", "ierrors.h"),
            False,
        )
        utils.copyFile(
            os.path.join(self.sourceDir(), "devices", "gdevdsp.h"),
            os.path.join(self.imageDir(), "include", "ghostscript", "gdevdsp.h"),
            False,
        )
        utils.copyFile(
            os.path.join(self.sourceDir(), "base", "gserrors.h"),
            os.path.join(self.imageDir(), "include", "ghostscript", "gserrors.h"),
            False,
        )
        utils.copyDir(os.path.join(self.sourceDir(), "lib"), os.path.join(self.imageDir(), "lib"), False)

        return True