From d72b899471014b0b5c5649237e91db90d74e299b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 6 Nov 2015 16:38:41 +0200 Subject: [PATCH] Fix installation on Mac OS X El Capitan // Resolve #312 --- HISTORY.rst | 2 ++ docs/faq.rst | 6 +++--- docs/installation.rst | 5 +---- scripts/get-platformio.py | 24 +++++++++++++----------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 28c99fe6..4ef2999b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -21,6 +21,8 @@ PlatformIO 2.0 * Fixed firmware uploading for `nordicrf51 `__ development platform (`issue #316 `_) +* Fixed installation on Mac OS X El Capitan + (`issue #312 `_) 2.3.4 (2015-10-13) ~~~~~~~~~~~~~~~~~~ diff --git a/docs/faq.rst b/docs/faq.rst index 833eb024..5f9d020c 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -92,8 +92,8 @@ Troubleshooting Installation ~~~~~~~~~~~~ -PlatformIO and ``scons`` aren't installed properly -'''''''''''''''''''''''''''''''''''''''''''''''''' +PlatformIO and SCons aren't installed properly +'''''''''''''''''''''''''''''''''''''''''''''' Try these solutions: @@ -104,7 +104,7 @@ Try these solutions: [sudo] pip uninstall scons [sudo] pip install scons - # if you have "error: option --single-version-externally-managed not recognized", then + # or if you have "error: option --single-version-externally-managed not recognized" [sudo] pip install --egg scons 2. Install PlatformIO using :ref:`installation_installer_script`. diff --git a/docs/installation.rst b/docs/installation.rst index 8d071240..dea735e2 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -41,7 +41,7 @@ Please *choose one of* the following installation options: Python Package Manager ~~~~~~~~~~~~~~~~~~~~~~ -The latest stable version of PlatformIO may be done via +The latest stable version of PlatformIO may be installed/upgraded via `pip `_ as follows: .. code-block:: bash @@ -52,9 +52,6 @@ The latest stable version of PlatformIO may be done via # install/upgrade the latest version of PlatformIO pip install -U platformio -.. warning:: - Known Issue: :ref:`faq_troubleshooting_sconssingverextmanaged` - Note that you may run into permissions issues running these commands. You have a few options here: diff --git a/scripts/get-platformio.py b/scripts/get-platformio.py index bcab3d14..e572a78d 100644 --- a/scripts/get-platformio.py +++ b/scripts/get-platformio.py @@ -62,11 +62,11 @@ def exec_command(*args, **kwargs): if p.returncode != 0: raise Exception("\n".join([out, err])) - return out + return out.strip() def exec_python_cmd(args): - return exec_command([CURINTERPRETER_PATH] + args).strip() + return exec_command([CURINTERPRETER_PATH] + args) def install_pip(): @@ -86,18 +86,20 @@ def install_pip(): os.unlink(f.name) -def install_pypi_packages(packages): - print (exec_python_cmd([ - "-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip", - "install", "-U"] + packages)) +def install_platformio(): + cmd = ["-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip"] + try: + print (exec_python_cmd(cmd + ["install", "-U", "platformio"])) + except Exception: + print (exec_python_cmd( + cmd + ["--no-cache-dir", "install", "-U", "platformio"])) def main(): steps = [ - ("Fixing Windows %PATH% Environment", fix_winpython_pathenv, []), - ("Installing Python Package Manager", install_pip, []), - ("Installing PlatformIO and dependencies", install_pypi_packages, - [["setuptools", "platformio"]]) + ("Fixing Windows %PATH% Environment", fix_winpython_pathenv), + ("Installing Python Package Manager", install_pip), + ("Installing PlatformIO and dependencies", install_platformio) ] if not IS_WINDOWS: @@ -109,7 +111,7 @@ def main(): break print ("\n==> %s ..." % s[0]) try: - s[1](*s[2]) + s[1]() print ("[SUCCESS]") except Exception, e: is_error = True