Skip to content

Commit

Permalink
0.7.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeterv committed May 3, 2016
1 parent ef730fb commit fb7181b
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 24 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Peter Melnichenko
Copyright (c) 2015 - 2016 Peter Melnichenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
80 changes: 61 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@ hererocks

|travis| |appveyor|

``hererocks`` is a single file Python script for installing `Lua <http://http://www.lua.org/>`_ (or `LuaJIT <http://luajit.org/>`_) and `LuaRocks <https://luarocks.org/>`_, its package manager, into a local directory. It configures Lua to only see packages installed by that bundled version of LuaRocks, so that the installation is isolated.
``hererocks`` is a single file Python 2.7/3.x script for installing `Lua <http://http://www.lua.org/>`_ (or `LuaJIT <http://luajit.org/>`_) and `LuaRocks <https://luarocks.org/>`_, its package manager, into a local directory. It configures Lua to only see packages installed by that bundled version of LuaRocks, so that the installation is isolated.

Supported platforms
-------------------
Basic usage
-----------

hererocks supports platforms that have ``gcc`` (``cc`` for OS X). When building Lua it emulates a ``make`` target, using ``linux``, ``macosx``, and ``freebsd`` on corresponding systems and falling back to ``posix`` and ``generic`` on others.
.. code-block:: bash
Windows support is almost implemented on master branch (`#8 <https://github.com/mpeterv/hererocks/issues/8>`_ `#17 <https://github.com/mpeterv/hererocks/issues/17>`_ `#18 <https://github.com/mpeterv/hererocks/issues/18>`_ `#19 <https://github.com/mpeterv/hererocks/issues/19>`_), but latest released version doesn't have it yet.
hererocks lua53 -l5.3 -rlatest # Install Lua 5.3 with latest LuaRocks into lua53 directory.
lua53/bin/lua -v # Lua can now be run from lua53/bin directory.
lua53/bin/luarocks --version # Same for LuaRocks.
lua53/bin/luarocks install luacheck # Libraries and programs installed with LuaRocks end up in
lua53/bin/luacheck --version # lua53 directory, too, with scripts in lua53/bin.
export PATH="$PWD/lua53/bin:$PATH" # Add it to PATH it to run programs directly,
lua -v # without lua53/bin prefix.
For more info see below or run ``hererocks --help`` for a complete listing of options.

Installation
------------
Expand All @@ -25,24 +33,35 @@ Using `pip <https://pypi.python.org/pypi/pip>`_: run ``pip install hererocks``,

Manually: download hererocks with ``wget https://raw.githubusercontent.com/mpeterv/hererocks/latest/hererocks.py``, then use ``python hererocks.py ...`` to run it.

Usage
-----
Requirements
------------

* Python 2.7 or 3.x
* Git for installing from Git repositories.
* Compiler:

* Windows: MinGW with tools such as ``gcc`` in PATH, or Visual Studio 2008 or later (see help message for ``--target``).
* OS X: ``cc``.
* Other: ``gcc``.

Command-line options
--------------------

Installation location
^^^^^^^^^^^^^^^^^^^^^

The first argument of ``hererocks`` command should be path to the directory where Lua and/or LuaRocks should be installed. If it does not exist, it will be created.

If installation directory already has Lua installed, a new version of Lua or LuaRocks can be installed over it as a seamless upgrade (packages installed with LuaRocks will keep working) provided new and old Lua minor versions are same. E.g. Lua 5.1.5 and LuaJIT 2.1 can be installed over Lua 5.1.1, but not over Lua 5.2.1. Otherwise, when installing an incompatible Lua version, the installation directory should be removed prior to running ``hererocks``. If ``hererocks`` detects that it has already installed requested version of Lua or LuaRocks into the directory, it will skip installation for that program, unless ``--ignore-installed/-i`` is used.
If installation directory already has Lua installed, a new version of Lua or LuaRocks can be installed over it as a seamless upgrade (packages installed with LuaRocks will keep working) provided new and old Lua minor versions are same. E.g. Lua 5.1.5 and LuaJIT 2.1 can be installed over Lua 5.1.1, but not over Lua 5.2.1. Otherwise, when installing an incompatible Lua version, the installation directory should be removed prior to running ``hererocks``. If ``hererocks`` detects that it has already installed requested version of Lua or LuaRocks built with same options into the directory, it will skip installation for that program, unless ``--ignore-installed/-i`` is used.

After installation Lua and LuaRocks binaries will be in the ``bin`` subdirectory of the installation directory. Scripts installed using LuaRocks will also turn up there. Lua binary is always named ``lua``, even if it's LuaJIT under the hood, and LuaRocks binary is named ``luarocks`` as usual.

Version selection
^^^^^^^^^^^^^^^^^

``--lua/-l``, ``--luajit/-j`` and ``--luarocks/-r`` options should be used to select versions of programs to install. There are three ways to specify how to fetch the sources:
``--lua/-l``, ``--luajit/-j`` and ``--luarocks/-r`` options select versions of programs to install. There are three ways to specify how to fetch the sources:

* Using version number, such as ``5.1.5``. If patch or minor versions are left out the latest possible version will be used, e.g. for Lua ``5.2`` is currently equivalent to ``5.2.4`` and for LuaJIT ``2.1`` is same as ``2.1.0-beta2``. ``^`` can be used to select the latest stable version. ``hererocks`` will fetch and unpack sources of the selected version from corresponding downloads location, verifying their SHA256 checksum.
* Using version number, such as ``5.1.5``. If patch or minor versions are left out the latest possible version will be used, e.g. for Lua ``5.2`` is currently equivalent to ``5.2.4`` and for LuaJIT ``2.1`` is same as ``2.1.0-beta2``. ``latest`` or ``^`` can be used to select the latest stable version. ``hererocks`` will fetch and unpack sources of the selected version from corresponding downloads location, verifying their SHA256 checksum.
* Using git URI plus reference to checkout, separated by ``@``. Default reference is ``master``, and there are default git URIs for Lua (https://github.com/lua/lua), LuaJIT (https://github.com/luajit/luajit) and LuaRocks (https://github.com/keplerproject/luarocks). For instance, ``--luajit @458a40b`` installs from a commit at the LuaJIT git repository and ``--luajit @`` installs from its master branch. ``hererocks`` will use ``git`` command for cloning.
* Using path to a local directory.

Expand All @@ -58,7 +77,7 @@ Available versions: 5.1 - 5.1.5, 5.2.0 - 5.2.4, 5.3.0 - 5.3.2.

Use ``5.1.0`` to install Lua ``5.1`` which was released without patch version for some reason.

When building Lua, ``hererocks`` tries to emulate a sensible ``make`` target. The default can be seen in the help message printed by ``hererocks --help``. To select another target use ``--target`` option. To build without readline library use ``--no-readline`` option.
When building Lua, ``hererocks`` tries to emulate a sensible ``make`` target. The default can be seen in the help message printed by ``hererocks --help``. To select another target use ``--target`` option.

Installing LuaJIT
^^^^^^^^^^^^^^^^^
Expand All @@ -79,8 +98,9 @@ Popular continuous integration services such as `Travis-CI <https://travis-ci.or

.. code-block:: yaml
language: python # Need python environment for pip
sudo: false # Use container-based infrastructure
language: python # Can use any language here, but if it's not 'python'
# it becomes necessary to pass '--user' to pip when installing hererocks.
sudo: false # Use container-based infrastructure.
env:
- LUA="lua 5.1"
Expand All @@ -91,15 +111,37 @@ Popular continuous integration services such as `Travis-CI <https://travis-ci.or
before_install:
- pip install hererocks
- hererocks here -r^ --$LUA # Install latest LuaRocks version
# plus the Lua version for this build job
# into 'here' subdirectory
- export PATH=$PATH:$PWD/here/bin # Add directory with all installed binaries to PATH
- hererocks env --$LUA -rlatest # Use latest LuaRocks, install into 'env' directory.
- export PATH="$PWD/env/bin:$PATH" # Add directory with all installed binaries to PATH.
- luarocks install busted
install:
- luarocks make # Install the rock, assuming there is a rockspec
# in the root of the repository
# in the root of the repository.
script:
- busted spec # Run the test suite, assuming tests are in the 'spec' subdirectory
- busted
Equivalent configuration (``appveyor.yml``) for `Appveyor <http://www.appveyor.com/>`_ that allows testing on Windows:

.. code-block:: yaml
environment:
matrix:
- LUA: "lua 5.1"
- LUA: "lua 5.2"
- LUA: "lua 5.3"
- LUA: "luajit 2.0"
- LUA: "luajit 2.1"
before_build:
- set PATH=%CD%\env\bin;C:\Python27\Scripts;%PATH% # Add directory containing 'pip'
- pip install hererocks # to PATH, too.
- hererocks env --%LUA% -rlatest
- luarocks install busted
build_script:
- luarocks make
test_script:
- busted
6 changes: 3 additions & 3 deletions hererocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
except ImportError:
import winreg

hererocks_version = "Hererocks 0.6.2"
hererocks_version = "Hererocks 0.7.0"
__all__ = ["main"]

opts = None
Expand Down Expand Up @@ -1574,14 +1574,14 @@ def main(argv=None):
help="Pass additional options to C compiler when building Lua or LuaJIT.")
parser.add_argument(
"--target", help="Select how to build Lua. "
"Windows-specific targets (mingw, vs and vsXX_YY) also affect LuaJIT. "
"Windows-specific targets (mingw, vs, vs_XX and vsXX_YY) also affect LuaJIT. "
"vs, vs_XX and vsXX_YY targets compile using cl.exe. "
"vsXX_YY targets (such as vs15_32) always set up Visual Studio 20XX (YYbit). "
"vs_32 and vs_64 pick latest version supporting selected architecture. "
"vs target uses cl.exe that's already in PATH or sets up "
"latest available Visual Studio, preferring tools for host architecture. "
"It's the default target on Windows unless cl.exe is not in PATH but gcc is, "
"in which case mingw target is used."
"in which case mingw target is used. "
"macosx target uses cc and the remaining targets use gcc, passing compiler "
"and linker flags the same way Lua's Makefile does when running make <target>.",
choices=[
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setuptools.setup(
name="hererocks",
version="0.6.2",
version="0.7.0",
description="Tool for installing Lua and LuaRocks locally",
long_description=long_description,
keywords="lua",
Expand Down

0 comments on commit fb7181b

Please sign in to comment.