configure.py
changeset 5 627c4a0fd0e7
parent 3 11d3954df52a
child 6 c3690ec91ef8
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    62             HB_NOMAKE_PARTS.append(part)
    62             HB_NOMAKE_PARTS.append(part)
    63 
    63 
    64 def run_process(args, cwd=None):
    64 def run_process(args, cwd=None):
    65     code = 0
    65     code = 0
    66     output = ""
    66     output = ""
       
    67 
       
    68     env = os.environ.copy()
       
    69     if "EPOCROOT" in env:
       
    70         epocroot = env.get("EPOCROOT")
       
    71         if not (epocroot.endswith("\\") or epocroot.endswith("/")):
       
    72             env["EPOCROOT"] = "%s/" % epocroot        
       
    73 
    67     if os.name == "nt":
    74     if os.name == "nt":
    68         env = os.environ.copy()
       
    69         epocroot = env.get("EPOCROOT")
       
    70         if epocroot:
       
    71             if not epocroot.endswith("\\") or epocroot.endswith("/"):
       
    72                 env["EPOCROOT"] = "%s/" % epocroot
       
    73             
       
    74         args = ["cmd.exe", "/C"] + args
    75         args = ["cmd.exe", "/C"] + args
    75         
    76         
    76     try:
    77     try:
    77         if cwd != None:
    78         if cwd != None:
    78             oldcwd = os.getcwd()
    79             oldcwd = os.getcwd()
    80         if sys.version_info[0] == 2 and sys.version_info[1] < 4:
    81         if sys.version_info[0] == 2 and sys.version_info[1] < 4:
    81             process = popen2.Popen4(args)
    82             process = popen2.Popen4(args)
    82             code = process.wait()
    83             code = process.wait()
    83             output = process.fromchild.read()
    84             output = process.fromchild.read()
    84         else:
    85         else:
    85             if os.name == "nt":
    86             process = subprocess.Popen(args, env=env, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
    86                 process = subprocess.Popen(args, env=env, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
    87             (stdout, stderr) = process.communicate()
    87                 (stdout, stderr) = process.communicate()
    88             code = process.returncode
    88                 code = process.returncode
    89             output = stdout + stderr
    89                 output = stdout + stderr
    90             
    90             else:
       
    91                 process = subprocess.Popen(args, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
       
    92                 (stdout, stderr) = process.communicate()
       
    93                 code = process.returncode
       
    94                 output = stdout + stderr
       
    95 
       
    96         if cwd != None:
    91         if cwd != None:
    97             os.chdir(oldcwd)
    92             os.chdir(oldcwd)
    98     except:
    93     except:
    99         code = -1
    94         code = -1
   100     return [code, output]
    95     return [code, output]
   713     config.set_value("HB_MKSPECS_DIR", ConfigFile.format_dir(basedir + "/mkspecs"))
   708     config.set_value("HB_MKSPECS_DIR", ConfigFile.format_dir(basedir + "/mkspecs"))
   714 
   709 
   715     if platform.name() == "symbian":
   710     if platform.name() == "symbian":
   716         if os.path.isdir("/s60"):
   711         if os.path.isdir("/s60"):
   717             config.set_value("HB_EXPORT_DIR", "hb/%1/%2")
   712             config.set_value("HB_EXPORT_DIR", "hb/%1/%2")
   718             config.set_value("HB_PRIVATE_EXPORT_DIR", "hb/%1/private/%2")
   713             config.set_value("HB_RESTRICTED_EXPORT_DIR", "hb/%1/restricted/%2")
   719         else:
   714         else:
   720             config.set_value("HB_EXPORT_DIR", "$${EPOCROOT}epoc32/include/mw/hb/%1/%2")
   715             config.set_value("HB_EXPORT_DIR", "$${EPOCROOT}epoc32/include/mw/hb/%1/%2")
   721             config.set_value("HB_PRIVATE_EXPORT_DIR", "$${EPOCROOT}epoc32/include/mw/hb/%1/private/%2")
   716             config.set_value("HB_RESTRICTED_EXPORT_DIR", "$${EPOCROOT}epoc32/include/mw/hb/%1/restricted/%2")
   722 
   717 
   723     if options.developer:
   718     if options.developer:
   724         add_remove_part("tests", True)
   719         add_remove_part("tests", True)
   725         add_remove_part("performance", True)
   720         add_remove_part("performance", True)
   726         add_remove_part("localization", True)
   721         add_remove_part("localization", True)
   829     args += ["--exclude", "\"*readme.txt\""]
   824     args += ["--exclude", "\"*readme.txt\""]
   830     args += ["--exclude", "\"*.pr?\""]
   825     args += ["--exclude", "\"*.pr?\""]
   831     args += ["--exclude", "\"*.qrc\""]
   826     args += ["--exclude", "\"*.qrc\""]
   832     args += ["--exclude", "\"*~\""]
   827     args += ["--exclude", "\"*~\""]
   833     args += ["--exclude", "variant/*"]
   828     args += ["--exclude", "variant/*"]
       
   829     args += ["--exclude", "\"*css.bin\""]
   834     if options.verbose:
   830     if options.verbose:
   835         print("INFO: Running %s" % " ".join(args))
   831         print("INFO: Running %s" % " ".join(args))
   836     os.system("python %s" % " ".join(args))
   832     os.system("python %s" % " ".join(args))
   837 
   833 
   838     # build host tools
   834     # build host tools
   855 
   851 
   856     # run qmake
   852     # run qmake
   857     if options.qmakebin:
   853     if options.qmakebin:
   858         qmake = options.qmakebin
   854         qmake = options.qmakebin
   859     
   855     
   860     # modify epocroot for symbian to have compatibility between qmake and raptor
       
   861     epocroot = os.environ.get("EPOCROOT")
       
   862     replace_epocroot = epocroot
       
   863     if epocroot:
       
   864         if epocroot.endswith("\\") or epocroot.endswith("/"):
       
   865             replace_epocroot = epocroot
       
   866         else:
       
   867             replace_epocroot = "%s/" % epocroot
       
   868     
       
   869     profile = os.path.join(sourcedir, "hb.pro")
   856     profile = os.path.join(sourcedir, "hb.pro")
   870     cachefile = os.path.join(currentdir, ".qmake.cache")
   857     cachefile = os.path.join(currentdir, ".qmake.cache")
   871     if options.msvc:
   858     if options.msvc:
   872         qmake = "%s -tp vc" % qmake
   859         qmake = "%s -tp vc" % qmake
   873     if not options.fast:
   860     if not options.fast:
   879     if options.verbose:
   866     if options.verbose:
   880         print("\nRunning %s -cache %s %s" % (qmake, cachefile, profile))
   867         print("\nRunning %s -cache %s %s" % (qmake, cachefile, profile))
   881     else:
   868     else:
   882         print("\nRunning qmake...")
   869         print("\nRunning qmake...")
   883     try:
   870     try:
   884         # replace the epocroot for the qmake runtime
   871 
   885         if replace_epocroot:
   872         # modify epocroot for symbian to have compatibility between qmake and raptor
   886             os.putenv("EPOCROOT", replace_epocroot)
   873         env = os.environ.copy()
   887         ret = os.system("%s -cache %s %s" % (qmake, cachefile, profile))
   874         if "EPOCROOT" in env:
   888         if replace_epocroot:
   875             epocroot = env.get("EPOCROOT")
   889             os.putenv("EPOCROOT", epocroot)
   876             if not (epocroot.endswith("\\") or epocroot.endswith("/")):
       
   877                 os.putenv("EPOCROOT", "%s/" % epocroot)
       
   878                 ret = os.system("%s -cache %s %s" % (qmake, cachefile, profile))
       
   879                 os.putenv("EPOCROOT", epocroot)
       
   880             else:
       
   881                 ret = os.system("%s -cache %s %s" % (qmake, cachefile, profile))
       
   882         else:
       
   883             ret = os.system("%s -cache %s %s" % (qmake, cachefile, profile))
       
   884     
   890     except KeyboardInterrupt:
   885     except KeyboardInterrupt:
   891         ret = -1
   886         ret = -1
   892     if ret != 0:
   887     if ret != 0:
   893         print("")
   888         print("")
   894         print("ERROR: Aborted!")
   889         print("ERROR: Aborted!")
   905             os.chdir(tsrcdir)
   900             os.chdir(tsrcdir)
   906             if options.verbose:
   901             if options.verbose:
   907                 print("\nRunning %s %s" % (qmake, profile))
   902                 print("\nRunning %s %s" % (qmake, profile))
   908             else:
   903             else:
   909                 print("\nRunning qmake in tsrc...")
   904                 print("\nRunning qmake in tsrc...")
   910             os.system("%s %s" % (qmake, profile))
   905             
       
   906             # epocroot cecking also for tests
       
   907             env = os.environ.copy()
       
   908             if "EPOCROOT" in env:
       
   909                 epocroot = env.get("EPOCROOT")
       
   910                 if not (epocroot.endswith("\\") or epocroot.endswith("/")):
       
   911                     os.putenv("EPOCROOT", "%s/" % epocroot)
       
   912                     os.system("%s %s" % (qmake, profile))
       
   913                     os.putenv("EPOCROOT", epocroot)
       
   914                 else:
       
   915                     os.system("%s %s" % (qmake, profile))
       
   916             else:
       
   917                 os.system("%s %s" % (qmake, profile))
   911             os.chdir(currentdir)
   918             os.chdir(currentdir)
   912 
   919 
   913             # create output dirs
   920             # create output dirs
   914             outputdir = os.path.join(currentdir, "autotest")
   921             outputdir = os.path.join(currentdir, "autotest")
   915             if not os.path.exists(outputdir):
   922             if not os.path.exists(outputdir):