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>`__
development platforms
(`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
`atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html#boards>`__
platform

View File

@ -113,17 +113,12 @@ same for the all projects, don't need to modify them):
function InstallPip ($python_home) {
$pip_path = $python_home + "/Scripts/pip.exe"
$python_path = $python_home + "/python.exe"
if (-not(Test-Path $pip_path)) {
Write-Host "Installing pip..."
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
Write-Host "Executing:" $python_path $GET_PIP_PATH
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
} else {
Write-Host "pip already installed."
}
Write-Host "Installing pip..."
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
Write-Host "Executing:" $python_path $GET_PIP_PATH
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
}
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
}
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 () {
InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON_HOME
InstallPip $env:PYTHON_HOME
InstallPackage $env:PYTHON_HOME setuptools
InstallPackage $env:PYTHON_HOME platformio
InstallScons $env:PYTHON_HOME
}
main

View File

@ -18,7 +18,7 @@ System requirements
* Mac OS X
* Linux, +ARM
* 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
`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``)
application.
Troubleshooting
---------------
.. warning::
If you are going to run *PlatformIO* from **subprocess**, you
:ref:`MUST DISABLE <faq_troubleshooting_pioblocksprompt>` all prompts.
@ -41,34 +44,52 @@ application:
**Windows Users:** Please check that you have correctly installed USB driver
from board manufacturer
Troubleshooting
---------------
For further details, frequently questions, please refer to :ref:`faq`.
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:
Super-Quick (Mac / Linux)
~~~~~~~~~~~~~~~~~~~~~~~~~
Python Package Manager
~~~~~~~~~~~~~~~~~~~~~~
To install or upgrade *PlatformIO* paste that at a *Terminal* prompt
(**you MIGHT need** to run ``sudo`` first, just for installation):
Run the following (**MAY require** administrator access ``sudo``):
.. 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...)
`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,
just for installation):
script. Then run the following (**MAY require** administrator access ``sudo``):
.. code-block:: bash
@ -96,9 +117,9 @@ Full Guide
.. 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.
* 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
<http://www.computerhope.com/issues/ch000549.htm>`_.
2. Check a ``pip`` tool for installing and managing *Python* packages:
2. Install a ``platformio`` and related packages:
.. code-block:: bash
$ pip search platformio
You should see short information about ``platformio`` package.
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>`_.
3. Install a ``platformio`` and related packages:
For upgrading ``platformio`` to the latest version:
.. code-block:: bash
$ pip install platformio && pip install --egg scons
For upgrading the ``platformio`` to new version please use this command:
.. code-block:: bash
$ pip install -U platformio
pip install --upgrade platformio
Development Version
~~~~~~~~~~~~~~~~~~~
@ -141,7 +153,8 @@ Install the latest PlatformIO from the ``develop`` branch:
.. 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,
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>
# See LICENSE for details.
VERSION = (2, 3, "0a1")
VERSION = (2, 3, "0a2")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

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

View File

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

View File

@ -87,21 +87,17 @@ def install_pip():
def install_pypi_packages(packages):
for pipargs in packages:
print (exec_python_cmd([
"-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip",
"install", "-U"] + pipargs))
print (exec_python_cmd([
"-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip",
"install", "-U"] + packages))
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"], [
"--egg", "http://dl.platformio.org/scons.zip"
]]
])
("Installing PlatformIO and dependencies", install_pypi_packages,
[["setuptools", "platformio"]])
]
if not IS_WINDOWS:

View File

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

View File

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