예제 #1
0
파일: run.py 프로젝트: jrobeson/platformio
def calculate_project_hash():
    structure = []
    for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()):
        if not isdir(d):
            continue
        for root, _, files in walk(d):
            for f in files:
                path = join(root, f)
                if not any([s in path for s in (".git", ".svn")]):
                    structure.append(path)
    return sha1(",".join(sorted(structure))).hexdigest() if structure else ""
예제 #2
0
def calculate_project_hash():
    structure = [__version__]
    for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()):
        if not isdir(d):
            continue
        for root, _, files in walk(d):
            for f in files:
                path = join(root, f)
                if not any([s in path for s in (".git", ".svn", ".pioenvs")]):
                    structure.append(path)
    return sha1(",".join(sorted(structure))).hexdigest() if structure else ""
예제 #3
0
def calculate_project_hash():
    check_suffixes = (".c", ".cc", ".cpp", ".h", ".hpp", ".s", ".S")
    structure = [__version__]
    for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()):
        if not isdir(d):
            continue
        for root, _, files in walk(d):
            for f in files:
                path = join(root, f)
                if path.endswith(check_suffixes):
                    structure.append(path)
    return sha1(",".join(sorted(structure))).hexdigest()
예제 #4
0
def calculate_project_hash():
    check_suffixes = (".c", ".cc", ".cpp", ".h", ".hpp", ".s", ".S")
    structure = [__version__]
    for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()):
        if not isdir(d):
            continue
        for root, _, files in walk(d):
            for f in files:
                path = join(root, f)
                if path.endswith(check_suffixes):
                    structure.append(path)
    return sha1(",".join(sorted(structure))).hexdigest()
예제 #5
0
def init_base_project(project_dir):
    if not util.is_platformio_project(project_dir):
        copyfile(join(util.get_source_dir(), "projectconftpl.ini"),
                 join(project_dir, "platformio.ini"))

    with util.cd(project_dir):
        lib_dir = util.get_projectlib_dir()
        src_dir = util.get_projectsrc_dir()
        for d in (src_dir, lib_dir):
            if not isdir(d):
                makedirs(d)

    init_lib_readme(lib_dir)
    init_ci_conf(project_dir)
    init_cvs_ignore(project_dir)
예제 #6
0
def calculate_project_hash():
    check_suffixes = (".c", ".cc", ".cpp", ".h", ".hpp", ".s", ".S")
    chunks = [__version__]
    for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()):
        if not isdir(d):
            continue
        for root, _, files in walk(d):
            for f in files:
                path = join(root, f)
                if path.endswith(check_suffixes):
                    chunks.append(path)
    chunks_to_str = ",".join(sorted(chunks))
    if "windows" in util.get_systype():
        # Fix issue with useless project rebuilding for case insensitive FS.
        # A case of disk drive can differ...
        chunks_to_str = chunks_to_str.lower()
    return sha1(chunks_to_str).hexdigest()
예제 #7
0
파일: run.py 프로젝트: xyu6/platformio-core
def calculate_project_hash():
    check_suffixes = (".c", ".cc", ".cpp", ".h", ".hpp", ".s", ".S")
    chunks = [__version__]
    for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()):
        if not isdir(d):
            continue
        for root, _, files in walk(d):
            for f in files:
                path = join(root, f)
                if path.endswith(check_suffixes):
                    chunks.append(path)
    chunks_to_str = ",".join(sorted(chunks))
    if "windows" in util.get_systype():
        # Fix issue with useless project rebuilding for case insensitive FS.
        # A case of disk drive can differ...
        chunks_to_str = chunks_to_str.lower()
    return sha1(chunks_to_str).hexdigest()
예제 #8
0
 def _gather_tplvars(self):
     self._tplvars.update(self.get_project_env())
     self._tplvars.update(self.get_project_build_data())
     with util.cd(self.project_dir):
         self._tplvars.update({
             "project_name": self.get_project_name(),
             "src_files": self.get_src_files(),
             "user_home_dir": abspath(expanduser("~")),
             "project_dir": self.project_dir,
             "project_src_dir": util.get_projectsrc_dir(),
             "project_lib_dir": util.get_projectlib_dir(),
             "project_libdeps_dir": util.get_projectlibdeps_dir(),
             "systype": util.get_systype(),
             "platformio_path": self._fix_os_path(
                 util.where_is_program("platformio")),
             "env_pathsep": os.pathsep,
             "env_path": self._fix_os_path(os.getenv("PATH"))
         })  # yapf: disable
예제 #9
0
 def _gather_tplvars(self):
     self._tplvars.update(self.get_project_env())
     self._tplvars.update(self.get_project_build_data())
     with util.cd(self.project_dir):
         self._tplvars.update({
             "project_name": self.get_project_name(),
             "src_files": self.get_src_files(),
             "user_home_dir": abspath(expanduser("~")),
             "project_dir": self.project_dir,
             "project_src_dir": util.get_projectsrc_dir(),
             "project_lib_dir": util.get_projectlib_dir(),
             "project_libdeps_dir": util.get_projectlibdeps_dir(),
             "systype": util.get_systype(),
             "platformio_path": self._fix_os_path(
                 sys.argv[0] if isfile(sys.argv[0])
                 else util.where_is_program("platformio")),
             "env_pathsep": os.pathsep,
             "env_path": self._fix_os_path(os.getenv("PATH"))
         })  # yapf: disable
예제 #10
0
def init_base_project(project_dir):
    if util.is_platformio_project(project_dir):
        return

    copyfile(join(util.get_source_dir(), "projectconftpl.ini"),
             join(project_dir, "platformio.ini"))

    with util.cd(project_dir):
        dir_to_readme = [
            (util.get_projectsrc_dir(), None),
            (util.get_projectinclude_dir(), init_include_readme),
            (util.get_projectlib_dir(), init_lib_readme),
            (util.get_projecttest_dir(), init_test_readme),
        ]
        for (path, cb) in dir_to_readme:
            if isdir(path):
                continue
            makedirs(path)
            if cb:
                cb(path)
예제 #11
0
def init_base_project(project_dir):
    if util.is_platformio_project(project_dir):
        return

    copyfile(
        join(util.get_source_dir(), "projectconftpl.ini"),
        join(project_dir, "platformio.ini"))

    with util.cd(project_dir):
        dir_to_readme = [
            (util.get_projectsrc_dir(), None),
            (util.get_projectinclude_dir(), init_include_readme),
            (util.get_projectlib_dir(), init_lib_readme),
            (util.get_projecttest_dir(), init_test_readme),
        ]
        for (path, cb) in dir_to_readme:
            if isdir(path):
                continue
            makedirs(path)
            if cb:
                cb(path)
예제 #12
0
    variables=commonvars,
    # Propagating External Environment
    PIOVARIABLES=commonvars.keys(),
    ENV=environ,
    UNIX_TIME=int(time()),
    PROGNAME="program",
    PIOHOME_DIR=util.get_home_dir(),
    PROJECT_DIR=util.get_project_dir(),
    PROJECTSRC_DIR=util.get_projectsrc_dir(),
    PROJECTTEST_DIR=util.get_projecttest_dir(),
    PROJECTDATA_DIR=util.get_projectdata_dir(),
    PROJECTPIOENVS_DIR=util.get_projectpioenvs_dir(),
    BUILD_DIR=join("$PROJECTPIOENVS_DIR", "$PIOENV"),
    BUILDSRC_DIR=join("$BUILD_DIR", "src"),
    BUILDTEST_DIR=join("$BUILD_DIR", "test"),
    LIBSOURCE_DIRS=[util.get_projectlib_dir(), util.get_projectlibdeps_dir(), join("$PIOHOME_DIR", "lib")],
    PYTHONEXE=util.get_pythonexe_path(),
)

if not int(ARGUMENTS.get("PIOVERBOSE", 0)):
    DEFAULT_ENV_OPTIONS["ARCOMSTR"] = "Archiving $TARGET"
    DEFAULT_ENV_OPTIONS["LINKCOMSTR"] = "Linking $TARGET"
    DEFAULT_ENV_OPTIONS["RANLIBCOMSTR"] = "Indexing $TARGET"
    for k in ("ASCOMSTR", "ASPPCOMSTR", "CCCOMSTR", "CXXCOMSTR"):
        DEFAULT_ENV_OPTIONS[k] = "Compiling $TARGET"

env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS)

# decode common variables
for k in commonvars.keys():
    if k in env:
예제 #13
0
    # upload options
    (
        "UPLOAD_PORT", ),
    ("UPLOAD_PROTOCOL", ),
    ("UPLOAD_SPEED", ))

DefaultEnvironment(tools=[
    "gcc", "g++", "as", "ar", "gnulink", "platformio", "pioupload", "pioar",
    "piomisc"
],
                   toolpath=[join("$PIOBUILDER_DIR", "tools")],
                   variables=commonvars,
                   UNIX_TIME=int(time()),
                   PIOHOME_DIR=util.get_home_dir(),
                   PROJECT_DIR=util.get_project_dir(),
                   PROJECTLIB_DIR=util.get_projectlib_dir(),
                   PROJECTSRC_DIR=util.get_projectsrc_dir(),
                   PIOENVS_DIR=util.get_pioenvs_dir(),
                   PIOBUILDER_DIR=join(util.get_source_dir(), "builder"),
                   PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"),
                   BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"),
                   BUILDSRC_DIR=join("$BUILD_DIR", "src"),
                   LIBSOURCE_DIRS=[
                       "$PROJECTLIB_DIR",
                       util.get_lib_dir(),
                       join("$PLATFORMFW_DIR", "libraries")
                   ])

env = DefaultEnvironment()

if "BOARD" in env:
예제 #14
0
파일: main.py 프로젝트: Cgruppo/platformio
    tools=[
        "gcc", "g++", "as", "ar", "gnulink",
        "platformio", "pioupload", "pioar", "piomisc"
    ],
    toolpath=[join("$PIOBUILDER_DIR", "tools")],
    variables=commonvars,

    # Propagating External Environment
    ENV=environ,

    UNIX_TIME=int(time()),
    PROGNAME="program",

    PIOHOME_DIR=util.get_home_dir(),
    PROJECT_DIR=util.get_project_dir(),
    PROJECTLIB_DIR=util.get_projectlib_dir(),
    PROJECTSRC_DIR=util.get_projectsrc_dir(),
    PROJECTDATA_DIR=util.get_projectdata_dir(),
    PIOENVS_DIR=util.get_pioenvs_dir(),

    PIOBUILDER_DIR=join(util.get_source_dir(), "builder"),
    PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"),

    BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"),
    BUILDSRC_DIR=join("$BUILD_DIR", "src"),
    LIBSOURCE_DIRS=[
        "$PROJECTLIB_DIR",
        util.get_lib_dir(),
        join("$PLATFORMFW_DIR", "libraries")
    ],
예제 #15
0
BOARD_OPTS = env.BoardConfig()
BOARD_BUILDOPTS = BOARD_OPTS.get("build", {})
BOARD_CORELIBDIRNAME = "cosa"
BOARD_VARIANTLIBDIRNAME = string.replace(str(BOARD_BUILDOPTS.get("variant")), "/", os.sep)

# IMPORTANT: PlatformIO packages dir is expected to have the following folder:
# - framework-cosa (symlink to <Cosa project root>)
FRAMEWORK_DIR = platform.get_package_dir("framework-cosa")
TOOLCHAIN_DIR = platform.get_package_dir("toolchain-atmelavr")

PLATFORMFW_DIR = FRAMEWORK_DIR

lib_dirs = env.get("LIBSOURCE_DIRS")

project_lib_dir = util.get_projectlib_dir()
for _, subdirs, _ in walk(project_lib_dir):
#  print("Adding project libraries:")
  for dir in subdirs:
    lib_dirs.append(join(project_lib_dir, dir))
#    print(join(project_lib_dir, dir))
  break

# Cosa
PLATFORMFW_LIBRARIES_DIR = join(PLATFORMFW_DIR, "libraries")
lib_dirs.append(PLATFORMFW_LIBRARIES_DIR)
lib_dirs.append(join(PLATFORMFW_DIR, "cores", BOARD_CORELIBDIRNAME))
lib_dirs.append(join(PLATFORMFW_DIR, "variants", BOARD_VARIANTLIBDIRNAME))

for _, subdirs, _ in walk(PLATFORMFW_LIBRARIES_DIR):
#  print("Adding Cosa libraries:")
예제 #16
0
    # Propagating External Environment
    PIOVARIABLES=commonvars.keys(),
    ENV=environ,
    UNIX_TIME=int(time()),
    PROGNAME="program",
    PIOHOME_DIR=util.get_home_dir(),
    PROJECT_DIR=util.get_project_dir(),
    PROJECTSRC_DIR=util.get_projectsrc_dir(),
    PROJECTTEST_DIR=util.get_projecttest_dir(),
    PROJECTDATA_DIR=util.get_projectdata_dir(),
    PROJECTPIOENVS_DIR=util.get_projectpioenvs_dir(),
    BUILD_DIR=join("$PROJECTPIOENVS_DIR", "$PIOENV"),
    BUILDSRC_DIR=join("$BUILD_DIR", "src"),
    BUILDTEST_DIR=join("$BUILD_DIR", "test"),
    LIBSOURCE_DIRS=[
        util.get_projectlib_dir(),
        util.get_projectlibdeps_dir(),
        join("$PIOHOME_DIR", "lib")
    ],
    PYTHONEXE=util.get_pythonexe_path())

if not int(ARGUMENTS.get("PIOVERBOSE", 0)):
    DEFAULT_ENV_OPTIONS['ARCOMSTR'] = "Archiving $TARGET"
    DEFAULT_ENV_OPTIONS['LINKCOMSTR'] = "Linking $TARGET"
    DEFAULT_ENV_OPTIONS['RANLIBCOMSTR'] = "Indexing $TARGET"
    for k in ("ASCOMSTR", "ASPPCOMSTR", "CCCOMSTR", "CXXCOMSTR"):
        DEFAULT_ENV_OPTIONS[k] = "Compiling $TARGET"

env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS)

# decode common variables
예제 #17
0
    # Propagating External Environment
    PIOVARIABLES=commonvars.keys(),
    ENV=environ,
    UNIX_TIME=int(time()),
    PROGNAME="program",
    PIOHOME_DIR=util.get_home_dir(),
    PROJECT_DIR=util.get_project_dir(),
    PROJECTSRC_DIR=util.get_projectsrc_dir(),
    PROJECTTEST_DIR=util.get_projecttest_dir(),
    PROJECTDATA_DIR=util.get_projectdata_dir(),
    PROJECTPIOENVS_DIR=util.get_projectpioenvs_dir(),
    BUILD_DIR=join("$PROJECTPIOENVS_DIR", "$PIOENV"),
    BUILDSRC_DIR=join("$BUILD_DIR", "src"),
    BUILDTEST_DIR=join("$BUILD_DIR", "test"),
    LIBSOURCE_DIRS=[
        util.get_projectlib_dir(), util.get_projectlibdeps_dir(),
        join("$PIOHOME_DIR", "lib")
    ],
    PYTHONEXE=util.get_pythonexe_path())

if not int(ARGUMENTS.get("PIOVERBOSE", 0)):
    DEFAULT_ENV_OPTIONS['ARCOMSTR'] = "Archiving $TARGET"
    DEFAULT_ENV_OPTIONS['LINKCOMSTR'] = "Linking $TARGET"
    DEFAULT_ENV_OPTIONS['RANLIBCOMSTR'] = "Indexing $TARGET"
    for k in ("ASCOMSTR", "ASPPCOMSTR", "CCCOMSTR", "CXXCOMSTR"):
        DEFAULT_ENV_OPTIONS[k] = "Compiling $TARGET"

env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS)

# decode common variables
for k in commonvars.keys():
예제 #18
0
    # Propagating External Environment
    PIOVARIABLES=commonvars.keys(),
    ENV=environ,
    UNIX_TIME=int(time()),
    PIOHOME_DIR=util.get_home_dir(),
    PROJECT_DIR=util.get_project_dir(),
    PROJECTINCLUDE_DIR=util.get_projectinclude_dir(),
    PROJECTSRC_DIR=util.get_projectsrc_dir(),
    PROJECTTEST_DIR=util.get_projecttest_dir(),
    PROJECTDATA_DIR=util.get_projectdata_dir(),
    PROJECTBUILD_DIR=util.get_projectbuild_dir(),
    BUILD_DIR=join("$PROJECTBUILD_DIR", "$PIOENV"),
    BUILDSRC_DIR=join("$BUILD_DIR", "src"),
    BUILDTEST_DIR=join("$BUILD_DIR", "test"),
    LIBSOURCE_DIRS=[
        util.get_projectlib_dir(),
        util.get_projectlibdeps_dir(),
        join("$PIOHOME_DIR", "lib")
    ],
    PROGNAME="program",
    PROG_PATH=join("$BUILD_DIR", "$PROGNAME$PROGSUFFIX"),
    PYTHONEXE=util.get_pythonexe_path())

if not int(ARGUMENTS.get("PIOVERBOSE", 0)):
    DEFAULT_ENV_OPTIONS['ARCOMSTR'] = "Archiving $TARGET"
    DEFAULT_ENV_OPTIONS['LINKCOMSTR'] = "Linking $TARGET"
    DEFAULT_ENV_OPTIONS['RANLIBCOMSTR'] = "Indexing $TARGET"
    for k in ("ASCOMSTR", "ASPPCOMSTR", "CCCOMSTR", "CXXCOMSTR"):
        DEFAULT_ENV_OPTIONS[k] = "Compiling $TARGET"

env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS)