Simplified installation process of PlatformIO // Resolve #274

This commit is contained in:
Ivan Kravets
2015-08-22 17:09:28 +03:00
parent 8e42c4ae31
commit a1483c263f
9 changed files with 63 additions and 73 deletions

View File

@ -12,6 +12,9 @@ Release History
`windows_x86 <http://docs.platformio.org/en/latest/platforms/windows_x86.html>`__ `windows_x86 <http://docs.platformio.org/en/latest/platforms/windows_x86.html>`__
development platforms development platforms
(`issue #263 <https://github.com/platformio/platformio/issues/263>`_) (`issue #263 <https://github.com/platformio/platformio/issues/263>`_)
* Simplified `installation <http://docs.platformio.org/en/latest/installation.html>`__
process of PlatformIO
(`issue #274 <https://github.com/platformio/platformio/issues/274>`_)
* Added support for Adafruit Gemma board to * Added support for Adafruit Gemma board to
`atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html#boards>`__ `atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html#boards>`__
platform platform

View File

@ -113,17 +113,12 @@ same for the all projects, don't need to modify them):
function InstallPip ($python_home) { function InstallPip ($python_home) {
$pip_path = $python_home + "/Scripts/pip.exe"
$python_path = $python_home + "/python.exe" $python_path = $python_home + "/python.exe"
if (-not(Test-Path $pip_path)) { Write-Host "Installing pip..."
Write-Host "Installing pip..." $webclient = New-Object System.Net.WebClient
$webclient = New-Object System.Net.WebClient $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) Write-Host "Executing:" $python_path $GET_PIP_PATH
Write-Host "Executing:" $python_path $GET_PIP_PATH Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
} else {
Write-Host "pip already installed."
}
} }
function InstallPackage ($python_home, $pkg) { function InstallPackage ($python_home, $pkg) {
@ -131,19 +126,11 @@ same for the all projects, don't need to modify them):
& $pip_path install -U $pkg & $pip_path install -U $pkg
} }
function InstallScons ($python_home) {
Write-Host "Start installing Scons"
$pip_path = $python_home + "/Scripts/pip.exe"
& $pip_path install --egg "http://dl.platformio.org/scons.zip"
Write-Host "Scons installed"
}
function main () { function main () {
InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON_HOME InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON_HOME
InstallPip $env:PYTHON_HOME InstallPip $env:PYTHON_HOME
InstallPackage $env:PYTHON_HOME setuptools InstallPackage $env:PYTHON_HOME setuptools
InstallPackage $env:PYTHON_HOME platformio InstallPackage $env:PYTHON_HOME platformio
InstallScons $env:PYTHON_HOME
} }
main main

View File

@ -18,7 +18,7 @@ System requirements
* Mac OS X * Mac OS X
* Linux, +ARM * Linux, +ARM
* Windows * Windows
* `Python 2.6 or Python 2.7 <https://www.python.org/downloads/>`_ * Python 2.6.x or Python 2.7.x(recommended)
All commands below should be executed in All commands below should be executed in
`Command-line <http://en.wikipedia.org/wiki/Command-line_interface>`_ `Command-line <http://en.wikipedia.org/wiki/Command-line_interface>`_
@ -29,6 +29,9 @@ application:
`Command Prompt <http://en.wikipedia.org/wiki/Command_Prompt>`_ (``cmd.exe``) `Command Prompt <http://en.wikipedia.org/wiki/Command_Prompt>`_ (``cmd.exe``)
application. application.
Troubleshooting
---------------
.. warning:: .. warning::
If you are going to run *PlatformIO* from **subprocess**, you If you are going to run *PlatformIO* from **subprocess**, you
:ref:`MUST DISABLE <faq_troubleshooting_pioblocksprompt>` all prompts. :ref:`MUST DISABLE <faq_troubleshooting_pioblocksprompt>` all prompts.
@ -41,34 +44,52 @@ application:
**Windows Users:** Please check that you have correctly installed USB driver **Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer from board manufacturer
Troubleshooting
---------------
For further details, frequently questions, please refer to :ref:`faq`. For further details, frequently questions, please refer to :ref:`faq`.
Installation Methods Installation Methods
-------------------- --------------------
.. note::
**Windows Users**: `Download the latest Python 2.7.x
<https://www.python.org/downloads/>`_ and install it.
*DON'T FORGET* to select ``Add python.exe to Path`` feature in installation
dialog on "Customize" stage.
Please *choose one of* the following installation methods: Please *choose one of* the following installation methods:
Super-Quick (Mac / Linux) Python Package Manager
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
To install or upgrade *PlatformIO* paste that at a *Terminal* prompt Run the following (**MAY require** administrator access ``sudo``):
(**you MIGHT need** to run ``sudo`` first, just for installation):
.. code-block:: bash .. code-block:: bash
[sudo] python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" pip install --upgrade pip setuptools scons
pip install platformio
If your computer does not recognize ``pip`` command, try to install it first
using `these instructions <https://pip.pypa.io/en/latest/installing.html>`_.
Installer Script
~~~~~~~~~~~~~~~~
Super-Quick (Mac / Linux)
'''''''''''''''''''''''''
To install or upgrade *PlatformIO* paste that at a *Terminal* prompt
(**MAY require** administrator access ``sudo``):
.. code-block:: bash
python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
Installer Script (Mac / Linux / Windows) Local Download (Mac / Linux / Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ''''''''''''''''''''''''''''''''''''''
To install or upgrade *PlatformIO*, download (save as...) To install or upgrade *PlatformIO*, download (save as...)
`get-platformio.py <https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py>`_ `get-platformio.py <https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py>`_
script. Then run the following (**you MIGHT need** to run ``sudo`` first, script. Then run the following (**MAY require** administrator access ``sudo``):
just for installation):
.. code-block:: bash .. code-block:: bash
@ -96,9 +117,9 @@ Full Guide
.. code-block:: bash .. code-block:: bash
$ python --version python --version
*Windows OS* Users only: *Windows Users* only:
* `Download Python 2.7 <https://www.python.org/downloads/>`_ and install it. * `Download Python 2.7 <https://www.python.org/downloads/>`_ and install it.
* Add to PATH system variable ``;C:\Python27;C:\Python27\Scripts;`` and * Add to PATH system variable ``;C:\Python27;C:\Python27\Scripts;`` and
@ -106,30 +127,21 @@ Full Guide
article `How to set the path and environment variables in Windows article `How to set the path and environment variables in Windows
<http://www.computerhope.com/issues/ch000549.htm>`_. <http://www.computerhope.com/issues/ch000549.htm>`_.
2. Install a ``platformio`` and related packages:
2. Check a ``pip`` tool for installing and managing *Python* packages:
.. code-block:: bash .. code-block:: bash
$ pip search platformio pip install --upgrade pip setuptools scons
pip install platformio
You should see short information about ``platformio`` package.
If your computer does not recognize ``pip`` command, try to install it first If your computer does not recognize ``pip`` command, try to install it first
using `these instructions <https://pip.pypa.io/en/latest/installing.html>`_. using `these instructions <https://pip.pypa.io/en/latest/installing.html>`_.
3. Install a ``platformio`` and related packages: For upgrading ``platformio`` to the latest version:
.. code-block:: bash .. code-block:: bash
$ pip install platformio && pip install --egg scons pip install --upgrade platformio
For upgrading the ``platformio`` to new version please use this command:
.. code-block:: bash
$ pip install -U platformio
Development Version Development Version
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
@ -141,7 +153,8 @@ Install the latest PlatformIO from the ``develop`` branch:
.. code-block:: bash .. code-block:: bash
$ pip install https://github.com/platformio/platformio/archive/develop.zip pip install -U pip setuptools scons
pip install -U https://github.com/platformio/platformio/archive/develop.zip
If you want to be up-to-date with the latest ``develop`` version of PlatformIO, If you want to be up-to-date with the latest ``develop`` version of PlatformIO,
then you need to re-install PlatformIO each time if you see the new commits in then you need to re-install PlatformIO each time if you see the new commits in

View File

@ -1,7 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com> # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details. # See LICENSE for details.
VERSION = (2, 3, "0a1") VERSION = (2, 3, "0a2")
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@ -80,7 +80,6 @@ def main():
) )
return 1 return 1
cli(None, None) cli(None, None)
except Exception as e: # pylint: disable=W0703 except Exception as e: # pylint: disable=W0703
if not isinstance(e, exception.ReturnErrorCode): if not isinstance(e, exception.ReturnErrorCode):

View File

@ -59,17 +59,12 @@ function InstallPython ($python_version, $architecture, $python_home) {
function InstallPip ($python_home) { function InstallPip ($python_home) {
$pip_path = $python_home + "/Scripts/pip.exe"
$python_path = $python_home + "/python.exe" $python_path = $python_home + "/python.exe"
if (-not(Test-Path $pip_path)) { Write-Host "Installing pip..."
Write-Host "Installing pip..." $webclient = New-Object System.Net.WebClient
$webclient = New-Object System.Net.WebClient $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) Write-Host "Executing:" $python_path $GET_PIP_PATH
Write-Host "Executing:" $python_path $GET_PIP_PATH Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
} else {
Write-Host "pip already installed."
}
} }
function InstallPackage ($python_home, $pkg) { function InstallPackage ($python_home, $pkg) {

View File

@ -87,21 +87,17 @@ def install_pip():
def install_pypi_packages(packages): def install_pypi_packages(packages):
for pipargs in packages: print (exec_python_cmd([
print (exec_python_cmd([ "-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip",
"-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip", "install", "-U"] + packages))
"install", "-U"] + pipargs))
def main(): def main():
steps = [ steps = [
("Fixing Windows %PATH% Environment", fix_winpython_pathenv, []), ("Fixing Windows %PATH% Environment", fix_winpython_pathenv, []),
("Installing Python Package Manager", install_pip, []), ("Installing Python Package Manager", install_pip, []),
("Installing PlatformIO and dependencies", install_pypi_packages, [ ("Installing PlatformIO and dependencies", install_pypi_packages,
[["setuptools"], ["platformio"], [ [["setuptools", "platformio"]])
"--egg", "http://dl.platformio.org/scons.zip"
]]
])
] ]
if not IS_WINDOWS: if not IS_WINDOWS:

View File

@ -22,7 +22,7 @@ setup(
"click>=3.0", "click>=3.0",
"pyserial", "pyserial",
"requests>=2.4.0", "requests>=2.4.0",
# "SCons" "SCons"
] + (["colorama"] if system() == "Windows" else []), ] + (["colorama"] if system() == "Windows" else []),
packages=find_packages(), packages=find_packages(),
package_data={ package_data={

View File

@ -10,8 +10,6 @@ usedevelop = True
deps = deps =
isort isort
flake8 flake8
commands =
pip install --egg http://dl.platformio.org/scons.zip
[testenv:docs] [testenv:docs]
basepython = python2.7 basepython = python2.7
@ -48,5 +46,4 @@ passenv = *
deps = pytest deps = pytest
commands = commands =
{envpython} --version {envpython} --version
pip install --egg http://dl.platformio.org/scons.zip
py.test -v --basetemp="{envtmpdir}" tests py.test -v --basetemp="{envtmpdir}" tests