当前位置: 首页>>代码示例>>Python>>正文


Python util.reltopdir函数代码示例

本文整理汇总了Python中pysim.util.reltopdir函数的典型用法代码示例。如果您正苦于以下问题:Python reltopdir函数的具体用法?Python reltopdir怎么用?Python reltopdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reltopdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_all

def build_all():
    """Run the build_all.sh script."""
    print("Running build_all.sh")
    if util.run_cmd(util.reltopdir('Tools/scripts/build_all.sh'), directory=util.reltopdir('.')) != 0:
        print("Failed build_all.sh")
        return False
    return True
开发者ID:Coonat2,项目名称:ardupilot,代码行数:7,代码来源:autotest.py

示例2: write_webresults

def write_webresults(results_to_write):
    """Write webpage results."""
    t = mavtemplate.MAVTemplate()
    for h in glob.glob(util.reltopdir('Tools/autotest/web/*.html')):
        html = util.loadfile(h)
        f = open(buildlogs_path(os.path.basename(h)), mode='w')
        t.write(f, html, results_to_write)
        f.close()
    for f in glob.glob(util.reltopdir('Tools/autotest/web/*.png')):
        shutil.copy(f, buildlogs_path(os.path.basename(f)))
开发者ID:Coonat2,项目名称:ardupilot,代码行数:10,代码来源:autotest.py

示例3: write_webresults

def write_webresults(results_to_write):
    """Write webpage results."""
    from pymavlink.generator import mavtemplate
    t = mavtemplate.MAVTemplate()
    for h in glob.glob(util.reltopdir('Tools/autotest/web/*.html')):
        html = util.loadfile(h)
        f = open(util.reltopdir("../buildlogs/%s" % os.path.basename(h)), mode='w')
        t.write(f, html, results_to_write)
        f.close()
    for f in glob.glob(util.reltopdir('Tools/autotest/web/*.png')):
        shutil.copy(f, util.reltopdir('../buildlogs/%s' % os.path.basename(f)))
开发者ID:IISAR,项目名称:ardupilot,代码行数:11,代码来源:autotest.py

示例4: convert_gpx

def convert_gpx():
    """Convert any tlog files to GPX and KML."""
    mavlog = glob.glob(util.reltopdir("../buildlogs/*.tlog"))
    for m in mavlog:
        util.run_cmd(util.reltopdir("modules/mavlink/pymavlink/tools/mavtogpx.py") + " --nofixcheck " + m)
        gpx = m + '.gpx'
        kml = m + '.kml'
        util.run_cmd('gpsbabel -i gpx -f %s -o kml,units=m,floating=1,extrude=1 -F %s' % (gpx, kml), checkfail=False)
        util.run_cmd('zip %s.kmz %s.kml' % (m, m), checkfail=False)
        util.run_cmd("mavflightview.py --imagefile=%s.png %s" % (m, m))
    return True
开发者ID:LanderU,项目名称:ardupilot,代码行数:11,代码来源:autotest.py

示例5: build_devrelease

def build_devrelease():
    """Run the build_devrelease.sh script."""
    print("Running build_devrelease.sh")
    # copy the script as it changes git branch, which can change the script while running
    orig = util.reltopdir('Tools/scripts/build_devrelease.sh')
    copy = util.reltopdir('./build_devrelease.sh')
    shutil.copy2(orig, copy)

    if util.run_cmd(copy, directory=util.reltopdir('.')) != 0:
        print("Failed build_devrelease.sh")
        return False
    return True
开发者ID:Coonat2,项目名称:ardupilot,代码行数:12,代码来源:autotest.py

示例6: build_binaries

def build_binaries():
    """Run the build_binaries.sh script."""
    print("Running build_binaries.sh")
    import shutil
    # copy the script as it changes git branch, which can change the script while running
    orig = util.reltopdir('Tools/scripts/build_binaries.sh')
    copy = util.reltopdir('./build_binaries.sh')
    shutil.copyfile(orig, copy)
    shutil.copymode(orig, copy)
    if util.run_cmd(copy, directory=util.reltopdir('.')) != 0:
        print("Failed build_binaries.sh")
        return False
    return True
开发者ID:IISAR,项目名称:ardupilot,代码行数:13,代码来源:autotest.py

示例7: disable_option_in_config

 def disable_option_in_config(self, var):
     tmpfile = util.reltopdir(self.config) + ".tmp"
     shutil.move(self.config, tmpfile)
     out_fd = open(self.config, 'w+')
     with open(util.reltopdir(tmpfile)) as fd:
         for line in fd:
             things_to_toggle = self.reverse_deps_for_var(var)
             things_to_toggle.append(var)
             for thing in things_to_toggle:
                 line = re.sub(
                     '//(#define\s+%s\s+(ENABLED|DISABLED))' % thing,
                     "\\1",
                     line)
             out_fd.write(line)
     out_fd.close()
开发者ID:FantasyJXF,项目名称:ardupilot,代码行数:15,代码来源:build-with-disabled-features.py

示例8: check_logs

def check_logs(step):
    """Check for log files from a step."""
    print("check step: ", step)
    if step.startswith('fly.'):
        vehicle = step[4:]
    elif step.startswith('drive.'):
        vehicle = step[6:]
    else:
        return
    logs = glob.glob("logs/*.BIN")
    for log in logs:
        bname = os.path.basename(log)
        newname = buildlogs_path("%s-%s" % (vehicle, bname))
        print("Renaming %s to %s" % (log, newname))
        shutil.move(log, newname)

    corefile = "core"
    if os.path.exists(corefile):
        newname = buildlogs_path("%s.core" % vehicle)
        print("Renaming %s to %s" % (corefile, newname))
        shutil.move(corefile, newname)
        try:
            util.run_cmd('/bin/cp build/sitl/bin/* %s' % buildlogs_dirpath(),
                         directory=util.reltopdir('.'))
        except Exception:
            print("Unable to save binary")
开发者ID:Coonat2,项目名称:ardupilot,代码行数:26,代码来源:autotest.py

示例9: binary_path

def binary_path(step, debug=False):
    try:
        vehicle = step.split(".")[1]
    except Exception:
        return None

    if vehicle in __bin_names:
        binary_name = __bin_names[vehicle]
    else:
        # cope with builds that don't have a specific binary
        return None

    if debug:
        binary_basedir = "sitl-debug"
    else:
        binary_basedir = "sitl"

    binary = util.reltopdir(os.path.join('build', binary_basedir, 'bin', binary_name))
    if not os.path.exists(binary):
        if os.path.exists(binary + ".exe"):
            binary += ".exe"
        else:
            raise ValueError("Binary (%s) does not exist" % (binary,))

    return binary
开发者ID:MonashUAS,项目名称:ardupilot,代码行数:25,代码来源:autotest.py

示例10: get_default_params

def get_default_params(atype, binary):
    """Get default parameters."""

    # use rover simulator so SITL is not starved of input
    from pymavlink import mavutil
    HOME = mavutil.location(40.071374969556928, -105.22978898137808, 1583.702759, 246)
    if binary.find("plane") != -1 or binary.find("rover") != -1:
        frame = "rover"
    else:
        frame = "+"

    home = "%f,%f,%u,%u" % (HOME.lat, HOME.lng, HOME.alt, HOME.heading)
    sitl = util.start_SITL(binary, wipe=True, model=frame, home=home, speedup=10, unhide_parameters=True)
    mavproxy = util.start_MAVProxy_SITL(atype)
    print("Dumping defaults")
    idx = mavproxy.expect(['Please Run Setup', 'Saved [0-9]+ parameters to (\S+)'])
    if idx == 0:
        # we need to restart it after eeprom erase
        util.pexpect_close(mavproxy)
        util.pexpect_close(sitl)
        sitl = util.start_SITL(binary, model=frame, home=home, speedup=10)
        mavproxy = util.start_MAVProxy_SITL(atype)
        idx = mavproxy.expect('Saved [0-9]+ parameters to (\S+)')
    parmfile = mavproxy.match.group(1)
    dest = util.reltopdir('../buildlogs/%s-defaults.parm' % atype)
    shutil.copy(parmfile, dest)
    util.pexpect_close(mavproxy)
    util.pexpect_close(sitl)
    print("Saved defaults for %s to %s" % (atype, dest))
    return True
开发者ID:IISAR,项目名称:ardupilot,代码行数:30,代码来源:autotest.py

示例11: binary_path

def binary_path(step, debug=False):
    if step.find("ArduCopter") != -1:
        binary_name = "arducopter"
    elif step.find("ArduPlane") != -1:
        binary_name = "arduplane"
    elif step.find("APMrover2") != -1:
        binary_name = "ardurover"
    elif step.find("AntennaTracker") != -1:
        binary_name = "antennatracker"
    elif step.find("CopterAVC") != -1:
        binary_name = "arducopter-heli"
    elif step.find("QuadPlane") != -1:
        binary_name = "arduplane"
    else:
        # cope with builds that don't have a specific binary
        return None

    if debug:
        binary_basedir = "sitl-debug"
    else:
        binary_basedir = "sitl"

    binary = util.reltopdir(os.path.join('build', binary_basedir, 'bin', binary_name))
    if not os.path.exists(binary):
        if os.path.exists(binary + ".exe"):
            binary += ".exe"
        else:
            raise ValueError("Binary (%s) does not exist" % (binary,))

    return binary
开发者ID:IISAR,项目名称:ardupilot,代码行数:30,代码来源:autotest.py

示例12: build_parameters

def build_parameters():
    """Run the param_parse.py script."""
    print("Running param_parse.py")
    if util.run_cmd(util.reltopdir('Tools/autotest/param_metadata/param_parse.py'), directory=util.reltopdir('.')) != 0:
        print("Failed param_parse.py")
        return False
    return True
开发者ID:IISAR,项目名称:ardupilot,代码行数:7,代码来源:autotest.py

示例13: __init__

 def __init__(self):
     self.date = time.asctime()
     self.githash = util.run_cmd('git rev-parse HEAD',
                                 output=True,
                                 directory=util.reltopdir('.')).strip()
     self.tests = []
     self.files = []
     self.images = []
开发者ID:Javiercerna,项目名称:ardupilot,代码行数:8,代码来源:autotest.py

示例14: build_binaries

def build_binaries():
    """Run the build_binaries.py script."""
    print("Running build_binaries.py")
    # copy the script as it changes git branch, which can change the script while running
    orig = util.reltopdir('Tools/scripts/build_binaries.py')
    copy = util.reltopdir('./build_binaries.py')
    shutil.copy2(orig, copy)

    # also copy generate_manifest library:
    orig_gm = util.reltopdir('Tools/scripts/generate_manifest.py')
    copy_gm = util.reltopdir('./generate_manifest.py')
    shutil.copy2(orig_gm, copy_gm)

    if util.run_cmd(copy, directory=util.reltopdir('.')) != 0:
        print("Failed build_binaries.py")
        return False
    return True
开发者ID:Coonat2,项目名称:ardupilot,代码行数:17,代码来源:autotest.py

示例15: build_works

 def build_works(self):
     self.progress("Building")
     autotest = util.reltopdir("Tools/autotest/autotest.py")
     try:
         ret = util.run_cmd([autotest, self.autotest_build])
     except subprocess.CalledProcessError:
         return False
     return ret == 0
开发者ID:FantasyJXF,项目名称:ardupilot,代码行数:8,代码来源:build-with-disabled-features.py


注:本文中的pysim.util.reltopdir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。