Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0349eee68 | ||
|
|
edd95bc6b1 | ||
|
|
dca47dcac5 | ||
|
|
d672ccd087 | ||
|
|
acd620b247 | ||
|
|
0b33cd59fc | ||
|
|
15388ec7b4 | ||
|
|
16f9a52e6c | ||
|
|
fdd1024833 | ||
|
|
c1cbbca543 | ||
|
|
ca2fd3194c | ||
|
|
a30d0dd550 |
@ -12,7 +12,7 @@ matrix:
|
|||||||
language: generic
|
language: generic
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo pip2 install pyflakes pycodestyle coverage coveralls nose; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo pip2 install pyflakes pycodestyle coverage coveralls nose --ignore-installed; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pip install pyflakes pycodestyle coverage coveralls nose; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pip install pyflakes pycodestyle coverage coveralls nose; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|||||||
243
CHANGELOG.md
Normal file
243
CHANGELOG.md
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 0.20.0 (2018-09-10)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for LuaRocks 3.0.0 - 3.0.2. `latest` and `^` aliases still
|
||||||
|
point to `2.4.4`.
|
||||||
|
* `--show` can now be used when installing programs; all programs present
|
||||||
|
in the given location are listed after installation is complete.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* `package.path` for Lua 5.3+ built with hererocks now includes `./?/init.lua`,
|
||||||
|
just as with standard Lua.
|
||||||
|
|
||||||
|
## 0.19.0 (2018-07-11)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for Lua 5.4.0-work1 and 5.4.0-work2.
|
||||||
|
* Added support for Lua 5.3.5.
|
||||||
|
* Added patches for Lua 5.3.4:
|
||||||
|
|
||||||
|
- `Lua crashes when building sequences with more than 2^30 elements`
|
||||||
|
- `Table length computation overflows for sequences larger than 2^31
|
||||||
|
elements`
|
||||||
|
- `Memory-allocation error when resizing a table can leave it in an
|
||||||
|
inconsistent state`
|
||||||
|
|
||||||
|
## 0.18.0 (2018-03-13)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for LuaRocks 2.4.4.
|
||||||
|
* Using `3` as version when installing LuaRocks now uses master branch of the
|
||||||
|
LuaRocks git repo instead of `luarocks-3`.
|
||||||
|
* Added `lua_pushcclosure should not call the garbage collector when n is zero`
|
||||||
|
patch for Lua 5.3.4.
|
||||||
|
|
||||||
|
## 0.17.0 (2017-09-13)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for LuaRocks 2.4.3.
|
||||||
|
* When installing PUC-Rio Lua from a git repo or local sources, source files
|
||||||
|
are expected to be in root directory instead of `src`. This allows one to
|
||||||
|
install Lua from the default Lua repo at github.com/lua/lua.
|
||||||
|
|
||||||
|
## 0.16.0 (2017-06-10)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for LuaJIT 2.0.5 and 2.1.0-beta3.
|
||||||
|
* Added fallback to a mirror for PUC-Rio Lua download.
|
||||||
|
* Added `--timeout` option for downloads.
|
||||||
|
|
||||||
|
## 0.15.0 (2017-04-02)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* When building Lua with custom cflags, hererocks now instructs LuaRocks to use
|
||||||
|
same flags when building C modules.
|
||||||
|
|
||||||
|
## 0.14.0 (2017-01-31)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for Lua 5.3.4.
|
||||||
|
|
||||||
|
## 0.13.1 (2017-01-09)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fixed an error when setting up cl.exe and hererocks has been installed using
|
||||||
|
a version of pip that passes `prefix/hererocks` instead of
|
||||||
|
`prefix/hererocks-script.py` as `sys.argv[0]`.
|
||||||
|
|
||||||
|
## 0.13.0 (2016-12-22)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for LuaRocks 2.4.2.
|
||||||
|
* LuaRocks is now configured to allow using config in user home directory.
|
||||||
|
In particular, API keys for `luarocks upload` command are now properly cached.
|
||||||
|
|
||||||
|
## 0.12.0 (2016-11-04)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for LuaRocks 2.4.1.
|
||||||
|
* Updated URL for LuaRocks downloads and default git repo.
|
||||||
|
|
||||||
|
## 0.11.0 (2016-09-10)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for LuaRocks 2.4.0.
|
||||||
|
* Added two new patches for bugs in Lua 5.3.3, try `--patch`.
|
||||||
|
* Caching of downloads now works on Unix-like systems even when `$HOME` is
|
||||||
|
unset (#28).
|
||||||
|
|
||||||
|
## 0.10.0 (2016-07-14)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* hererocks now creates activation scripts a-la virtualenv in `<location>/bin`.
|
||||||
|
Bash, Zsh, Dash, Fish, Csh, Batch, and PowerShell are supported.
|
||||||
|
* Lua 5.3.3 can now be patched to fix a bug (`Expression list with four or more
|
||||||
|
expressions in a 'for' loop can crash the interpreter`), try `--patch`.
|
||||||
|
|
||||||
|
## 0.9.0 (2016-06-21)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for LuaRocks 2.0.13.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fixed occasional SHA256 mismatches when downloading LuaJIT (#27).
|
||||||
|
|
||||||
|
## 0.8.1 (2016-06-12)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fixed error when installing from non-default git repo on Windows.
|
||||||
|
|
||||||
|
## 0.8.0 (2016-06-07)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Added support for Lua 5.3.3.
|
||||||
|
|
||||||
|
## 0.7.0 (2016-05-03)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Windows support with automatic Visual Studio setup.
|
||||||
|
* New values for `--target` option for selecting Visual Studio version and
|
||||||
|
target architecture.
|
||||||
|
* New `--show` option for listing programs installed in a location.
|
||||||
|
* New `--patch` option for applying official patches for bugs in Lua (#21).
|
||||||
|
* Documented `--downloads` and `--builds` options, may be useful for caching.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fixed an error when a command failed when using Python 3 (#15).
|
||||||
|
* Fixed error when running with `HOME` environment variable undefined (#24).
|
||||||
|
|
||||||
|
## 0.6.2 (2016-03-22)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Fixed a bug that resulted in Lua being built without compatibility flags (#14).
|
||||||
|
|
||||||
|
## 0.6.1 (2016-03-22) [yanked]
|
||||||
|
|
||||||
|
## 0.6.0 (2016-03-20)
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
* `hererocks --luajit 2.1` now installs LuaJIT 2.1.0-beta2 instead of
|
||||||
|
using v2.1 git branch. Use `hererocks --luajit @v2.1` to get old behaviour.
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* LuaJIT versions 2.1.0-beta1 - 2.1.0-beta2 are now supported.
|
||||||
|
* Lua is now built manually (`make` is not run).
|
||||||
|
* OS X 10.4+ support for Lua 5.1.0 - 5.1.2.
|
||||||
|
* SHA256 checksums for downloaded archives are now verified (#13).
|
||||||
|
* `--no-readline` flag for building Lua without readline library.
|
||||||
|
* Lua archives are now downloaded using HTTPS.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* `luajit.h` is installed for LuaJIT (#11, #12).
|
||||||
|
* `jit.*` modules work correctly for LuaJIT 2.0.1.
|
||||||
|
|
||||||
|
## 0.5.0 (2016-01-11)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
LuaRocks 2.3.0 is now supported.
|
||||||
|
|
||||||
|
## 0.4.0 (2016-01-03)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Documented --no-git-cache option.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fixed error when installing Lua 5.1 on OS X, thanks to @xpol.
|
||||||
|
|
||||||
|
## 0.3.1 (2015-12-22)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fetch LuaJIT from GitHub mirror archive to avoid 'Connection refused' errors
|
||||||
|
when installing it on Travis.
|
||||||
|
|
||||||
|
## 0.3.0 (2015-12-19)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* LuaRocks versions 2.0.8 - 2.0.12 are now supported.
|
||||||
|
* `--compat=none` now turns off Lua 5.0 compatibility options when installing
|
||||||
|
Lua 5.1
|
||||||
|
* Default git repos are cached.
|
||||||
|
* New `--cflags` option for adding custom compiler flags when compiling Lua and
|
||||||
|
LuaJIT.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* LuaJIT `jit.*` modules are now properly installed.
|
||||||
|
|
||||||
|
## 0.2.0 (2015-12-02)
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* Lua 5.3.2 is now supported.
|
||||||
|
* Versions of installed programs are showed in status messages.
|
||||||
|
|
||||||
|
## 0.1.0 (2015-11-29)
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
* Removed `-c` and `-t` shortcuts.
|
||||||
|
|
||||||
|
### New features and improvements
|
||||||
|
|
||||||
|
* `--verbose` flag that prints commands hererocks runs.
|
||||||
|
* hererocks now checks if requested versions are already installed, and skips
|
||||||
|
installation in that case. Override using `--ignore-installed/-i` flag.
|
||||||
|
* PUC Rio Lua now has default git URI.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Installing from a git branch now works with newer git versions.
|
||||||
|
|
||||||
|
## 0.0.3 (2015-08-14)
|
||||||
|
|
||||||
|
The first release.
|
||||||
@ -95,7 +95,7 @@ Lua and LuaJIT have some flags that add compatibility with other Lua versions. L
|
|||||||
Installing standard PUC-Rio Lua
|
Installing standard PUC-Rio Lua
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Available versions: 5.1 - 5.1.5, 5.2.0 - 5.2.4, 5.3.0 - 5.3.5, 5.4.0-work1 - 5.4.0-work2 (5.4 and 5.4.0 are aliases for 5.4.0-work2).
|
Available versions: 5.1 - 5.1.5, 5.2.0 - 5.2.4, 5.3.0 - 5.3.5, 5.4.0-work1 - 5.4.0-work2 (5.4 and 5.4.0 are aliases for 5.4.0-work2). ``latest`` and ``^`` version aliases point to ``5.3.5``.
|
||||||
|
|
||||||
Use ``5.1.0`` to install Lua ``5.1`` which was released without patch version for some reason.
|
Use ``5.1.0`` to install Lua ``5.1`` which was released without patch version for some reason.
|
||||||
|
|
||||||
@ -104,12 +104,12 @@ When building Lua, ``hererocks`` tries to emulate a sensible ``make`` target. Th
|
|||||||
Installing LuaJIT
|
Installing LuaJIT
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Available versions: 2.0.0 - 2.0.5, 2.1.0-beta1 - 2.1.0-beta3.
|
Available versions: 2.0.0 - 2.0.5, 2.1.0-beta1 - 2.1.0-beta3. ``latest`` and ``^`` version aliases point to ``2.0.5``.
|
||||||
|
|
||||||
Installing LuaRocks
|
Installing LuaRocks
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Available versions: 2.0.8 - 2.0.13, 2.1.0 - 2.1.2, 2.2.0 - 2.2.2, 2.3.0, 2.4.0 - 2.4.4, 3 (installs from ``master`` branch of the LuaRocks git repository).
|
Available versions: 2.0.8 - 2.0.13, 2.1.0 - 2.1.2, 2.2.0 - 2.2.2, 2.3.0, 2.4.0 - 2.4.4, 3.0.0 - 3.0.2. ``latest`` and ``^`` version aliases point to ``2.4.4``.
|
||||||
|
|
||||||
Version 2.0.8 does not support Lua 5.2. Versions 2.0.8 - 2.1.2 do not support Lua 5.3.
|
Version 2.0.8 does not support Lua 5.2. Versions 2.0.8 - 2.1.2 do not support Lua 5.3.
|
||||||
|
|
||||||
|
|||||||
175
hererocks.py
175
hererocks.py
@ -35,7 +35,7 @@ if os.name == "nt":
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import winreg
|
import winreg
|
||||||
|
|
||||||
hererocks_version = "Hererocks 0.19.0"
|
hererocks_version = "Hererocks 0.20.0"
|
||||||
__all__ = ["main"]
|
__all__ = ["main"]
|
||||||
|
|
||||||
opts = None
|
opts = None
|
||||||
@ -691,6 +691,10 @@ class Lua(Program):
|
|||||||
os.path.join(module_path, "?", "init.lua")
|
os.path.join(module_path, "?", "init.lua")
|
||||||
]
|
]
|
||||||
module_path_parts.insert(0 if local_paths_first else 2, os.path.join(".", "?.lua"))
|
module_path_parts.insert(0 if local_paths_first else 2, os.path.join(".", "?.lua"))
|
||||||
|
|
||||||
|
if self.major_version in ["5.3", "5.4"]:
|
||||||
|
module_path_parts.append(os.path.join(".", "?", "init.lua"))
|
||||||
|
|
||||||
self.package_path = ";".join(module_path_parts)
|
self.package_path = ";".join(module_path_parts)
|
||||||
|
|
||||||
cmodule_path = os.path.join(opts.location, "lib", "lua", self.major_version)
|
cmodule_path = os.path.join(opts.location, "lib", "lua", self.major_version)
|
||||||
@ -1618,7 +1622,8 @@ class LuaRocks(Program):
|
|||||||
"2.1.0", "2.1.1", "2.1.2",
|
"2.1.0", "2.1.1", "2.1.2",
|
||||||
"2.2.0", "2.2.1", "2.2.2",
|
"2.2.0", "2.2.1", "2.2.2",
|
||||||
"2.3.0",
|
"2.3.0",
|
||||||
"2.4.0", "2.4.1", "2.4.2", "2.4.3", "2.4.4"
|
"2.4.0", "2.4.1", "2.4.2", "2.4.3", "2.4.4",
|
||||||
|
"3.0.0", "3.0.1", "3.0.2"
|
||||||
]
|
]
|
||||||
translations = {
|
translations = {
|
||||||
"2": "2.4.4",
|
"2": "2.4.4",
|
||||||
@ -1627,7 +1632,8 @@ class LuaRocks(Program):
|
|||||||
"2.2": "2.2.2",
|
"2.2": "2.2.2",
|
||||||
"2.3": "2.3.0",
|
"2.3": "2.3.0",
|
||||||
"2.4": "2.4.4",
|
"2.4": "2.4.4",
|
||||||
"3": "@master",
|
"3": "3.0.2",
|
||||||
|
"3.0": "3.0.2",
|
||||||
"^": "2.4.4",
|
"^": "2.4.4",
|
||||||
"latest": "2.4.4"
|
"latest": "2.4.4"
|
||||||
}
|
}
|
||||||
@ -1668,6 +1674,12 @@ class LuaRocks(Program):
|
|||||||
"luarocks-2.4.3-win32.zip" : "08821ec39e7c3ad20f5b3d3e118ba8f1f5a7db6e6ad22e11eb5e8a2bdc95cbfb",
|
"luarocks-2.4.3-win32.zip" : "08821ec39e7c3ad20f5b3d3e118ba8f1f5a7db6e6ad22e11eb5e8a2bdc95cbfb",
|
||||||
"luarocks-2.4.4.tar.gz" : "3938df33de33752ff2c526e604410af3dceb4b7ff06a770bc4a240de80a1f934",
|
"luarocks-2.4.4.tar.gz" : "3938df33de33752ff2c526e604410af3dceb4b7ff06a770bc4a240de80a1f934",
|
||||||
"luarocks-2.4.4-win32.zip" : "763d2fbe301b5f941dd5ea4aea485fb35e75cbbdceca8cc2f18726b75f9895c1",
|
"luarocks-2.4.4-win32.zip" : "763d2fbe301b5f941dd5ea4aea485fb35e75cbbdceca8cc2f18726b75f9895c1",
|
||||||
|
"luarocks-3.0.0.tar.gz" : "a43fffb997100f11cccb529a3db5456ce8dab18171a5cb3645f948147b6f64a1",
|
||||||
|
"luarocks-3.0.0-win32.zip" : "f5c6070f49f78ef61a2e5d6de353b34ef691ad4a6b45e065d5c85701a4a3a981",
|
||||||
|
"luarocks-3.0.1.tar.gz" : "b989c4b60d6c9edcd65169e5e42fcffbd39cdbebe6b138fa5aea45102f8d9ec0",
|
||||||
|
"luarocks-3.0.1-win32.zip" : "af54263b8f71406d79556c880f3e2674e6690934a69cefbbdfd18710f05eeeaf",
|
||||||
|
"luarocks-3.0.2.tar.gz" : "3836267eff2f85fb552234e966602b1e649c58f81f47c7de3785e071c8127f5a",
|
||||||
|
"luarocks-3.0.2-win32.zip" : "c9e93d7198f9ae7add331675d3d84fa1b61feb851814ee2a89b9930bd651bfb9",
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_download_name(self):
|
def get_download_name(self):
|
||||||
@ -1967,6 +1979,71 @@ class UseActualArgsFileAction(argparse.Action):
|
|||||||
|
|
||||||
main(args_content.split("\r\n")[1:])
|
main(args_content.split("\r\n")[1:])
|
||||||
|
|
||||||
|
def install_programs(vs_already_set_up):
|
||||||
|
global temp_dir
|
||||||
|
temp_dir = tempfile.mkdtemp()
|
||||||
|
|
||||||
|
if (opts.lua or opts.luajit) and os.name == "nt" and not vs_already_set_up and using_cl():
|
||||||
|
setup_vs(opts.target)
|
||||||
|
|
||||||
|
start_dir = os.getcwd()
|
||||||
|
opts.location = os.path.abspath(opts.location)
|
||||||
|
|
||||||
|
if opts.downloads is not None:
|
||||||
|
opts.downloads = os.path.abspath(opts.downloads)
|
||||||
|
|
||||||
|
if opts.builds is not None:
|
||||||
|
opts.builds = os.path.abspath(opts.builds)
|
||||||
|
|
||||||
|
identifiers = get_installed_identifiers()
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.join(opts.location, "bin")):
|
||||||
|
os.makedirs(os.path.join(opts.location, "bin"))
|
||||||
|
|
||||||
|
write_activation_scripts()
|
||||||
|
|
||||||
|
if opts.lua:
|
||||||
|
if "LuaJIT" in identifiers:
|
||||||
|
del identifiers["LuaJIT"]
|
||||||
|
|
||||||
|
if RioLua(opts.lua).update_identifiers(identifiers):
|
||||||
|
save_installed_identifiers(identifiers)
|
||||||
|
|
||||||
|
os.chdir(start_dir)
|
||||||
|
|
||||||
|
if opts.luajit:
|
||||||
|
if "lua" in identifiers:
|
||||||
|
del identifiers["lua"]
|
||||||
|
|
||||||
|
if LuaJIT(opts.luajit).update_identifiers(identifiers):
|
||||||
|
save_installed_identifiers(identifiers)
|
||||||
|
|
||||||
|
os.chdir(start_dir)
|
||||||
|
|
||||||
|
if opts.luarocks:
|
||||||
|
if LuaRocks(opts.luarocks).update_identifiers(identifiers):
|
||||||
|
save_installed_identifiers(identifiers)
|
||||||
|
|
||||||
|
os.chdir(start_dir)
|
||||||
|
|
||||||
|
remove_dir(temp_dir)
|
||||||
|
print("Done.")
|
||||||
|
|
||||||
|
def show_location():
|
||||||
|
if os.path.exists(opts.location):
|
||||||
|
all_identifiers = get_installed_identifiers()
|
||||||
|
|
||||||
|
if all_identifiers:
|
||||||
|
print("Programs installed in {}:".format(opts.location))
|
||||||
|
|
||||||
|
for program in [RioLua, LuaJIT, LuaRocks]:
|
||||||
|
if program.name in all_identifiers:
|
||||||
|
show_identifiers(all_identifiers[program.name])
|
||||||
|
else:
|
||||||
|
print("No programs installed in {}.".format(opts.location))
|
||||||
|
else:
|
||||||
|
print("{} does not exist.".format(opts.location))
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description=hererocks_version + ", a tool for installing Lua and/or LuaRocks locally.",
|
description=hererocks_version + ", a tool for installing Lua and/or LuaRocks locally.",
|
||||||
@ -1980,8 +2057,8 @@ def main(argv=None):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-l", "--lua", help="Version of standard PUC-Rio Lua to install. "
|
"-l", "--lua", help="Version of standard PUC-Rio Lua to install. "
|
||||||
"Version can be specified as a version number, e.g. 5.2 or 5.3.1. "
|
"Version can be specified as a version number, e.g. 5.2 or 5.3.1. "
|
||||||
"Versions 5.1.0 - 5.3.5 are supported, as well as 5.4.0-work1 and 5.4.0-work2. "
|
"Versions 5.1.0 - 5.3.5 and 5.4.0-work1 - 5.4.0-work2 are supported. "
|
||||||
"'^' or 'latest' can be used to install the latest stable version. "
|
"'latest' and '^' are aliases for 5.3.5. "
|
||||||
"If the argument contains '@', sources will be downloaded "
|
"If the argument contains '@', sources will be downloaded "
|
||||||
"from a git repo using URI before '@' and using part after '@' as git reference "
|
"from a git repo using URI before '@' and using part after '@' as git reference "
|
||||||
"to checkout, 'master' by default. "
|
"to checkout, 'master' by default. "
|
||||||
@ -1993,17 +2070,19 @@ def main(argv=None):
|
|||||||
"-j", "--luajit", help="Version of LuaJIT to install. "
|
"-j", "--luajit", help="Version of LuaJIT to install. "
|
||||||
"Version can be specified in the same way as for standard Lua. "
|
"Version can be specified in the same way as for standard Lua. "
|
||||||
"Versions 2.0.0 - 2.1.0-beta3 are supported. "
|
"Versions 2.0.0 - 2.1.0-beta3 are supported. "
|
||||||
"When installing from the LuaJIT main git repo its URI can be left out, "
|
"'latest' and '^' are aliases for to 2.0.5. "
|
||||||
"so that '@458a40b' installs from a commit and '@' installs from the master branch.")
|
"Default git repo is https://github.com/luajit/luajit. ")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-r", "--luarocks", help="Version of LuaRocks to install. "
|
"-r", "--luarocks", help="Version of LuaRocks to install. "
|
||||||
"As with Lua, a version number (in range 2.0.8 - 2.4.4), '^', git URI with reference or "
|
"Version can be specified in the same way as for standard Lua. "
|
||||||
"a local path can be used. '3' can be used as a version number and installs from "
|
"Versions 2.0.8 - 3.0.2 are supported. "
|
||||||
"the 'master' branch of the standard LuaRocks git repo. "
|
"'latest' and '^' are aliases for 2.4.4. "
|
||||||
"Note that Lua 5.2 is not supported in LuaRocks 2.0.8 "
|
"Default git repo is https://github.com/luarocks/luarocks. "
|
||||||
"and Lua 5.3 is supported only since LuaRocks 2.2.0.")
|
"Note that Lua 5.2 is not supported in LuaRocks 2.0.8, "
|
||||||
|
"Lua 5.3 is supported only since LuaRocks 2.2.0, and Lua 5.4 is supported only since "
|
||||||
|
"LuaRocks 3.0.0.")
|
||||||
parser.add_argument("--show", default=False, action="store_true",
|
parser.add_argument("--show", default=False, action="store_true",
|
||||||
help="Instead of installing show programs already present in <location>")
|
help="Show programs installed in <location>, possibly after installing new ones.")
|
||||||
parser.add_argument("-i", "--ignore-installed", default=False, action="store_true",
|
parser.add_argument("-i", "--ignore-installed", default=False, action="store_true",
|
||||||
help="Install even if requested version is already present.")
|
help="Install even if requested version is already present.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -2065,79 +2144,17 @@ def main(argv=None):
|
|||||||
global opts
|
global opts
|
||||||
opts = parser.parse_args(argv)
|
opts = parser.parse_args(argv)
|
||||||
if not opts.lua and not opts.luajit and not opts.luarocks and not opts.show:
|
if not opts.lua and not opts.luajit and not opts.luarocks and not opts.show:
|
||||||
parser.error("nothing to do")
|
parser.error("a version of Lua, LuaJIT, or LuaRocks needs to be specified unless --show is used")
|
||||||
|
|
||||||
if opts.lua and opts.luajit:
|
if opts.lua and opts.luajit:
|
||||||
parser.error("can't install both PUC-Rio Lua and LuaJIT")
|
parser.error("can't install both PUC-Rio Lua and LuaJIT")
|
||||||
|
|
||||||
if (opts.lua or opts.luajit or opts.luarocks) and opts.show:
|
if opts.lua or opts.luajit or opts.luarocks:
|
||||||
parser.error("can't both install and show")
|
install_programs(argv is not None)
|
||||||
|
|
||||||
if opts.show:
|
if opts.show:
|
||||||
if os.path.exists(opts.location):
|
show_location()
|
||||||
all_identifiers = get_installed_identifiers()
|
|
||||||
|
|
||||||
if all_identifiers:
|
|
||||||
print("Programs installed in {}:".format(opts.location))
|
|
||||||
|
|
||||||
for program in [RioLua, LuaJIT, LuaRocks]:
|
|
||||||
if program.name in all_identifiers:
|
|
||||||
show_identifiers(all_identifiers[program.name])
|
|
||||||
else:
|
|
||||||
print("No programs installed in {}.".format(opts.location))
|
|
||||||
else:
|
|
||||||
print("Location does not exist.")
|
|
||||||
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
global temp_dir
|
|
||||||
temp_dir = tempfile.mkdtemp()
|
|
||||||
|
|
||||||
if (opts.lua or opts.luajit) and os.name == "nt" and argv is None and using_cl():
|
|
||||||
setup_vs(opts.target)
|
|
||||||
|
|
||||||
start_dir = os.getcwd()
|
|
||||||
opts.location = os.path.abspath(opts.location)
|
|
||||||
|
|
||||||
if opts.downloads is not None:
|
|
||||||
opts.downloads = os.path.abspath(opts.downloads)
|
|
||||||
|
|
||||||
if opts.builds is not None:
|
|
||||||
opts.builds = os.path.abspath(opts.builds)
|
|
||||||
|
|
||||||
identifiers = get_installed_identifiers()
|
|
||||||
|
|
||||||
if not os.path.exists(os.path.join(opts.location, "bin")):
|
|
||||||
os.makedirs(os.path.join(opts.location, "bin"))
|
|
||||||
|
|
||||||
write_activation_scripts()
|
|
||||||
|
|
||||||
if opts.lua:
|
|
||||||
if "LuaJIT" in identifiers:
|
|
||||||
del identifiers["LuaJIT"]
|
|
||||||
|
|
||||||
if RioLua(opts.lua).update_identifiers(identifiers):
|
|
||||||
save_installed_identifiers(identifiers)
|
|
||||||
|
|
||||||
os.chdir(start_dir)
|
|
||||||
|
|
||||||
if opts.luajit:
|
|
||||||
if "lua" in identifiers:
|
|
||||||
del identifiers["lua"]
|
|
||||||
|
|
||||||
if LuaJIT(opts.luajit).update_identifiers(identifiers):
|
|
||||||
save_installed_identifiers(identifiers)
|
|
||||||
|
|
||||||
os.chdir(start_dir)
|
|
||||||
|
|
||||||
if opts.luarocks:
|
|
||||||
if LuaRocks(opts.luarocks).update_identifiers(identifiers):
|
|
||||||
save_installed_identifiers(identifiers)
|
|
||||||
|
|
||||||
os.chdir(start_dir)
|
|
||||||
|
|
||||||
remove_dir(temp_dir)
|
|
||||||
print("Done.")
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -9,7 +9,7 @@ readme.close()
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="hererocks",
|
name="hererocks",
|
||||||
version="0.19.0",
|
version="0.20.0",
|
||||||
description="Tool for installing Lua and LuaRocks locally",
|
description="Tool for installing Lua and LuaRocks locally",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
keywords="lua",
|
keywords="lua",
|
||||||
|
|||||||
@ -150,3 +150,7 @@ class TestCLI(unittest.TestCase):
|
|||||||
def test_install_lua_5_4_with_luarocks_3(self):
|
def test_install_lua_5_4_with_luarocks_3(self):
|
||||||
self.assertHererocksSuccess(["--lua", "5.4", "--luarocks", "3"])
|
self.assertHererocksSuccess(["--lua", "5.4", "--luarocks", "3"])
|
||||||
self.assertHererocksSuccess(["--lua", "5.4.0-work1", "--luarocks", "3"])
|
self.assertHererocksSuccess(["--lua", "5.4.0-work1", "--luarocks", "3"])
|
||||||
|
|
||||||
|
if os.name == "nt":
|
||||||
|
self.assertHererocksSuccess(["--lua", "5.4", "--luarocks", "3", "--target", "vs"])
|
||||||
|
self.assertHererocksSuccess(["--lua", "5.4.0-work1", "--luarocks", "3", "--target", "vs"])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user