示例#1
0
    def run(self, variables, targets, verbose):
        assert isinstance(variables, list)
        assert isinstance(targets, list)

        self._verbose_level = int(verbose)

        installed_platforms = PlatformFactory.get_platforms(
            installed=True).keys()
        installed_packages = PackageManager.get_installed()

        if self.get_type() not in installed_platforms:
            raise exception.PlatformNotInstalledYet(self.get_type())

        if "clean" in targets:
            targets.remove("clean")
            targets.append("-c")

        if not any([v.startswith("BUILD_SCRIPT=") for v in variables]):
            variables.append("BUILD_SCRIPT=%s" % self.get_build_script())

        for v in variables:
            if not v.startswith("BUILD_SCRIPT="):
                continue
            _, path = v.split("=", 2)
            if not isfile(path):
                raise exception.BuildScriptNotFound(path)

        # append aliases of the installed packages
        for name, options in self.get_packages().items():
            if "alias" not in options or name not in installed_packages:
                continue
            variables.append(
                "PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))

        self._found_error = False
        try:
            # test that SCons is installed correctly
            assert util.test_scons()

            result = util.exec_command(
                [
                    "scons",
                    "-Q",
                    "-f", join(util.get_source_dir(), "builder", "main.py")
                ] + variables + targets,
                stdout=util.AsyncPipe(self.on_run_out),
                stderr=util.AsyncPipe(self.on_run_err)
            )
        except (OSError, AssertionError):
            raise exception.SConsNotInstalledError()

        assert "returncode" in result
        # if self._found_error:
        #     result['returncode'] = 1

        if self._last_echo_line == ".":
            click.echo("")

        return result
示例#2
0
    def run(self, variables, targets, verbose):
        assert isinstance(variables, list)
        assert isinstance(targets, list)

        self._verbose_level = int(verbose)

        installed_platforms = PlatformFactory.get_platforms(
            installed=True).keys()
        installed_packages = PackageManager.get_installed()

        if self.get_type() not in installed_platforms:
            raise exception.PlatformNotInstalledYet(self.get_type())

        if "clean" in targets:
            targets.remove("clean")
            targets.append("-c")

        if not any([v.startswith("BUILD_SCRIPT=") for v in variables]):
            variables.append("BUILD_SCRIPT=%s" % self.get_build_script())

        for v in variables:
            if not v.startswith("BUILD_SCRIPT="):
                continue
            _, path = v.split("=", 2)
            if not isfile(path):
                raise exception.BuildScriptNotFound(path)

        # append aliases of the installed packages
        for name, options in self.get_packages().items():
            if "alias" not in options or name not in installed_packages:
                continue
            variables.append("PIOPACKAGE_%s=%s" %
                             (options['alias'].upper(), name))

        self._found_error = False
        try:
            # test that SCons is installed correctly
            assert util.test_scons()

            result = util.exec_command([
                "scons", "-Q", "-f",
                join(util.get_source_dir(), "builder", "main.py")
            ] + variables + targets,
                                       stdout=util.AsyncPipe(self.on_run_out),
                                       stderr=util.AsyncPipe(self.on_run_err))
        except (OSError, AssertionError):
            raise exception.SConsNotInstalled()

        assert "returncode" in result
        # if self._found_error:
        #     result['returncode'] = 1

        if self._last_echo_line == ".":
            click.echo("")

        return result
示例#3
0
    def run(self, variables, targets, verbose):
        assert isinstance(variables, list)
        assert isinstance(targets, list)

        envoptions = {}
        for v in variables:
            _name, _value = v.split("=", 1)
            envoptions[_name.lower()] = _value

        self.configure_default_packages(envoptions, targets)
        self._install_default_packages()

        self._verbose_level = int(verbose)

        if "clean" in targets:
            targets.remove("clean")
            targets.append("-c")

        if "build_script" not in envoptions:
            variables.append("BUILD_SCRIPT=%s" % self.get_build_script())

        for v in variables:
            if not v.startswith("BUILD_SCRIPT="):
                continue
            _, path = v.split("=", 1)
            if not isfile(path):
                raise exception.BuildScriptNotFound(path)

        # append aliases of the installed packages
        installed_packages = PackageManager.get_installed()
        for name, options in self.get_packages().items():
            if "alias" not in options or name not in installed_packages:
                continue
            variables.append(
                "PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))

        self._found_error = False
        try:
            # test that SCons is installed correctly
            assert util.test_scons()

            result = util.exec_command(
                [
                    "scons",
                    "-Q",
                    "-j %d" % self.get_job_nums(),
                    "--warn=no-no-parallel-support",
                    "-f", join(util.get_source_dir(), "builder", "main.py")
                ] + variables + targets,
                stdout=util.AsyncPipe(self.on_run_out),
                stderr=util.AsyncPipe(self.on_run_err)
            )
        except (OSError, AssertionError):
            raise exception.SConsNotInstalledError()

        assert "returncode" in result
        # if self._found_error:
        #     result['returncode'] = 1

        if self._last_echo_line == ".":
            click.echo("")

        return result
示例#4
0
from platform import system

from setuptools import find_packages, setup

from platformio import (__author__, __description__, __email__, __license__,
                        __title__, __url__, __version__, util)

install_requires = [
    "bottle", "click>=3.2", "lockfile>=0.9.1", "pyserial", "requests>=2.4.0"
]

if system() == "Windows":
    install_requires.append("colorama")

if (not util.test_scons() and not util.install_scons()) or util.scons_in_pip():
    install_requires.append("scons")

setup(name=__title__,
      version=__version__,
      description=__description__,
      long_description=open("README.rst").read(),
      author=__author__,
      author_email=__email__,
      url=__url__,
      license=__license__,
      install_requires=install_requires,
      packages=find_packages(),
      package_data={
          "platformio": [
              "projectconftpl.ini", "boards/*.json", "ide/tpls/*/.*.tpl",
示例#5
0
文件: setup.py 项目: dh1tw/platformio
from platformio import (__author__, __description__, __email__, __license__,
                        __title__, __url__, __version__, util)

install_requires = [
    "bottle",
    "click>=3.2,<6",
    "lockfile>=0.9.1",
    "pyserial",
    "requests>=2.4.0"
]

if system() == "Windows":
    install_requires.append("colorama")

if not util.test_scons():
    util.install_scons()
elif util.scons_in_pip():
    install_requires.append("scons")

setup(
    name=__title__,
    version=__version__,
    description=__description__,
    long_description=open("README.rst").read(),
    author=__author__,
    author_email=__email__,
    url=__url__,
    license=__license__,
    install_requires=install_requires,
    packages=find_packages(),
示例#6
0
from platform import system

from setuptools import find_packages, setup

from platformio import (__author__, __description__, __email__, __license__,
                        __title__, __url__, __version__, util)

install_requires = [
    "bottle", "click>=3.2,<6", "lockfile>=0.9.1", "pyserial", "requests>=2.4.0"
]

if system() == "Windows":
    install_requires.append("colorama")

if not util.test_scons():
    util.install_scons()
elif util.scons_in_pip():
    install_requires.append("scons")

setup(name=__title__,
      version=__version__,
      description=__description__,
      long_description=open("README.rst").read(),
      author=__author__,
      author_email=__email__,
      url=__url__,
      license=__license__,
      install_requires=install_requires,
      packages=find_packages(),
      package_data={
示例#7
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from platform import system

from setuptools import find_packages, setup

from platformio import __author__, __description__, __email__, __license__, __title__, __url__, __version__, util

install_requires = ["bottle", "click>=3.2,<6", "lockfile>=0.9.1", "pyserial", "requests>=2.4.0"]

if system() == "Windows":
    install_requires.append("colorama")

if (not util.test_scons() and not util.install_scons()) or util.scons_in_pip():
    install_requires.append("scons")

setup(
    name=__title__,
    version=__version__,
    description=__description__,
    long_description=open("README.rst").read(),
    author=__author__,
    author_email=__email__,
    url=__url__,
    license=__license__,
    install_requires=install_requires,
    packages=find_packages(),
    package_data={
        "platformio": [