Compare commits

..

251 Commits

Author SHA1 Message Date
Peter Melnichenko
c0349eee68
0.20.0 release 2018-09-10 18:50:43 +03:00
Peter Melnichenko
edd95bc6b1
Add support for LuaRocks 3.0.2 but set 2.4.4 as stable again 2018-09-10 18:09:54 +03:00
Peter Melnichenko
dca47dcac5 Add CHANGELOG.md 2018-08-18 15:29:20 +03:00
Peter Melnichenko
d672ccd087 Move install action into a separate function 2018-08-18 12:21:54 +03:00
Peter Melnichenko
acd620b247 Allow using --show together with installing
--show now always lists programs installed in given location, possibly
after installing some.
2018-08-18 11:38:11 +03:00
Peter Melnichenko
0b33cd59fc More description error when no programs are specified 2018-08-18 11:31:29 +03:00
Peter Melnichenko
15388ec7b4 Add support for LuaRocks 3.0.1 2018-08-18 11:08:53 +03:00
Peter Melnichenko
16f9a52e6c Attempt to fix OS X Travis build 2018-08-07 13:40:52 +03:00
Peter Melnichenko
fdd1024833 Fix ./?/init.lua not being in package path for Lua 5.3+ 2018-08-07 12:41:14 +03:00
Peter Melnichenko
c1cbbca543 Support LuaRocks 3.0.0 and alias ^ and latest to it 2018-07-26 19:27:30 +03:00
Peter Melnichenko
ca2fd3194c Revert incorrect fix for the Lua 5.4.0-work2 VS problem 2018-07-11 21:28:54 +03:00
Peter Melnichenko
a30d0dd550 Fix 5.4 build when using VS 2018-07-11 21:17:48 +03:00
Peter Melnichenko
732397ef98 0.19.0 release 2018-07-11 20:17:58 +03:00
Peter Melnichenko
cc7bb37e1a Fix newly introduced error when installing Luarocks on win
Archive names contain dots, don't remove too much
when stripping extensions.
2018-07-11 13:48:26 +03:00
Peter Melnichenko
095dcc9b4a Add Lua 5.4.0-work{1,2} to supported releases
Refactor the way download names and urls are acquired to
allow more flexibility.
2018-07-11 13:21:43 +03:00
Peter Melnichenko
68d9caef5a Use pycodestyle instead of pep8, fix its warnings and config 2018-07-10 20:07:27 +03:00
Peter Melnichenko
49b8acac6e Support Lua 5.3.5 2018-07-10 19:15:32 +03:00
Peter Melnichenko
cecb55f5ad Add missing patches for Lua 5.3.4 2018-07-10 17:11:44 +03:00
Peter Melnichenko
bfd7d8efd1 Preliminary Lua 5.4 support
Now Lua 5.4 work1 can be properly installed by unpacking its
.tar.gz and running `hererocks <prefix> -l <untared>/src`.
Use `--cflags=-DLUA_NILINTABLE` if very brave.
2018-03-15 22:19:45 +03:00
Peter Melnichenko
cc30733d11 0.18.0 release (fixed) 2018-03-13 13:19:41 +03:00
Peter Melnichenko
3f370377e7 0.18.0 release 2018-03-13 13:16:04 +03:00
Peter Melnichenko
66b2e9bc7a Another attempt to fix build on OS X 2018-03-13 13:08:11 +03:00
Peter Melnichenko
4ce0ab9daa Fix OS X Travis CI 2018-03-13 12:58:28 +03:00
Peter Melnichenko
a8d4e2c08d Add a patch for Lua 5.3.4 2018-03-13 12:48:36 +03:00
Peter Melnichenko
248de26b94 Fix a test installing Lua from git
Bleeding edge Lua is now 5.4 and not supported by LuaRocks,
use latest 5.3 commit instead.
2018-03-13 12:46:08 +03:00
Peter Melnichenko
2d0e07cf7f Add support for LuaRocks 2.4.4, update LuaRocks 3 branch
Use @master instead of @luarocks-3 for LuaRocks 3.
2018-03-13 12:40:49 +03:00
Peter Melnichenko
46d1e02119 0.17.0 release 2017-09-13 16:50:59 +03:00
Peter Melnichenko
d18b005558 Fix a pyflakes warning 2017-09-13 16:19:21 +03:00
Peter Melnichenko
898256d5c3 Update --help for PUC-Rio Lua repo changes 2017-09-13 16:16:51 +03:00
Peter Melnichenko
0e3fc45758 Support new directory structure of PUC-Rio Lua git repo
When installing PUC-Rio Lua from git or local sources,
look for source files in root project directory instead
of `src`.

Default PUC-Rio Lua repo does not contain sources for luac.
It lacks lua.hpp, too.
2017-09-13 16:11:36 +03:00
Peter Melnichenko
7f6f5b02b5 Add patches for Lua 5.3.4 2017-09-13 12:35:34 +03:00
Peter Melnichenko
8cc94db304 Update license year 2017-09-13 12:23:23 +03:00
Peter Melnichenko
8289a5f705 Merge pull request #38 from fperrad/luarocks
Add LuaRocks 2.4.3 support
2017-09-13 12:18:50 +03:00
Francois Perrad
c44db4fcdb Add LuaRocks 2.4.3 support 2017-09-13 11:02:27 +02:00
Peter Melnichenko
3d66ed47ab Fix README.rst for 0.16.0 2017-06-10 19:56:31 +03:00
Peter Melnichenko
a614537aad 0.16.0 release 2017-06-10 19:39:58 +03:00
Peter Melnichenko
1704d44482 Show version suffix in fetching stage
Used version is not always obvious when version
is specified as `latest`, show it as early as possible.
2017-06-08 13:04:43 +03:00
Peter Melnichenko
870b84d673 Make subprocess output decoding more resilient
Use platform default encoding, ignore decoding errors.
2017-05-02 22:07:45 +03:00
Peter Melnichenko
265b77f365 Add timeout on downloads and --timeout option
Default timeout is 1 minute per mirror.
2017-05-02 21:38:27 +03:00
Peter Melnichenko
03cba28315 Add mirror support, include official PUC-Rio Lua mirror URL 2017-05-02 21:26:17 +03:00
Peter Melnichenko
1aa8a8a028 Add support for LuaJIT 2.0.5 and 2.1.0-beta3 2017-05-02 21:03:13 +03:00
Peter Melnichenko
15b8240a65 0.15.0 release 2017-04-02 20:53:12 +03:00
Peter Melnichenko
cdd9e172e3 Append custom CFLAGS to LuaRocks config
Ref #33.
2017-03-21 13:56:30 +03:00
Peter Melnichenko
cd483f5c91 0.14.0 release 2017-01-31 14:24:53 +03:00
Peter Melnichenko
d173a0b717 Add support for Lua 5.3.4 2017-01-31 14:16:20 +03:00
Peter Melnichenko
3ca0d2e863 0.13.1 release 2017-01-09 14:14:43 +03:00
Peter Melnichenko
09ea6dd2e4 Fix recursive call on Windows
For some reason sys.argv[0] may contain path to the python wrapper
(hererocks-script.py) or just "hererocks". Use inspect.getsourcefile
to get hererocks file location instead.
2017-01-09 12:35:40 +03:00
Peter Melnichenko
6840fa3eb9 0.13.0 release 2016-12-22 13:33:59 +03:00
Peter Melnichenko
5f83340455 Fix test broken by github.com/lua/lua changes 2016-12-06 18:11:37 +03:00
Peter Melnichenko
893ea86826 Add Luarocks 2.4.2 support 2016-12-06 15:55:49 +03:00
Peter Melnichenko
24c5bfbffd Allow using Luarocks config in home dir 2016-12-06 15:50:35 +03:00
Peter Melnichenko
8afe784657 0.12.0 release 2016-11-04 00:19:19 +03:00
Peter Melnichenko
e89c557d23 Use new luarocks org name 2016-11-04 00:16:40 +03:00
Peter Melnichenko
e26ac2e05a Add support for Luarocks 2.4.1 2016-10-27 20:17:57 +03:00
Peter Melnichenko
3af691efe9 Fix OS X CI
Do not `brew install` python on OS X, it's already installed on the
new image Travis uses.
2016-10-27 20:09:11 +03:00
Peter Melnichenko
012172c020 Handle unicode in output correctly in tests under py2 2016-10-16 17:53:54 +03:00
Peter Melnichenko
fba0462779 0.11.0 release 2016-09-10 14:16:21 +03:00
Peter Melnichenko
88514214a1 Add two new patches for Lua 5.3.3 2016-09-10 13:48:29 +03:00
Peter Melnichenko
c5d5cf1424 Add support for LuaRocks 2.4.0 2016-09-10 13:32:31 +03:00
Peter Melnichenko
7afe537d52 Merge pull request #28 from starius/expanduser
use os.path.expanduser to get home dir on Unix
2016-07-29 13:36:51 +04:00
Boris Nagaev
c0ae601f3c use os.path.expanduser to get home dir on Unix
It works even if HOME is not set.
2016-07-28 11:46:58 +03:00
Peter Melnichenko
6e7854fd05 0.10.0 release 2016-07-14 18:30:38 +03:00
Peter Melnichenko
e7d5ca4bf6 Fix batch activation file for paths with parens 2016-07-14 10:23:18 +03:00
Peter Melnichenko
81d0094d67 Attempt to fix tests 2016-07-14 12:10:28 +03:00
Peter Melnichenko
1439be0036 Add a test for activation scripts 2016-07-14 12:03:14 +03:00
Peter Melnichenko
bf1bd19713 Implement activation script for powershell
Also fix activation script for batch error when location path
contains spaces.
2016-07-13 15:31:31 +03:00
Peter Melnichenko
8b8f75d14c Implement activation script for batch 2016-07-13 13:26:49 +03:00
Peter Melnichenko
5df72f9631 Fix error when location dir doesn't exist beforehand
Introduced in parent commit.
2016-07-12 23:43:09 +03:00
Peter Melnichenko
5ba64a4379 Implement activation scripts for POSIX-enough shells
When creating an environment write activation scripts into $PREFIX/bin.
An activation script, when sourced, adds $PREFIX/bin to $PATH and adds
'deactivate-lua' function that removes it. Activating an environment
automatically deactivates previous one.

Supported shells:

* bash, zsh, dash: $PREFIX/bin/activate
* fish: $PREFIX/bin/activate.fish
* csh, tcsh: $PREFIX/bin/activate.csh

Also fixed compilation error for location paths containing double quotes.

TODO: add activation scripts for Windoss (powershell and batch).
Ref #23.
2016-07-12 19:44:41 +03:00
Peter Melnichenko
d45a05939f Use textwrap.dedent 2016-07-12 12:27:02 +03:00
Peter Melnichenko
f45c1352f2 More verbose patching reporting by default
If --patch is used, showing names of applied patches seems like a good
idea.
2016-06-27 11:48:38 +03:00
Peter Melnichenko
83ac3076b7 Add patch for a bug in Lua 5.3.3 2016-06-27 11:48:33 +03:00
Peter Melnichenko
ac3507688a Fix typo in README.rst [ci skip] 2016-06-27 11:32:38 +03:00
Peter Melnichenko
c7c37cfc4a 0.9.0 release
Also change development status from 'Alpha' to 'Beta' because the
thing has been working more a less for quite some time.
2016-06-21 21:22:49 +03:00
Peter Melnichenko
1ec06f2499 Disable unused caching on travis 2016-06-21 20:43:04 +03:00
Peter Melnichenko
a9b8ab94d9 Fix SHA256 mismatch when downloading with chunked transfer enconding
Switch to urllib2, urllib doesn't support chunked.
2016-06-21 20:32:15 +03:00
Peter Melnichenko
7c436e7632 Add support for LuaRocks 2.0.13 2016-06-17 20:33:22 +03:00
Peter Melnichenko
1839dd5cc6 0.8.1 release 2016-06-12 23:51:21 +03:00
Peter Melnichenko
fa0a6f6a53 Deal with read-only files when removing directories
Fixes error on windows when installing from non-default
git repo (for some reason a few files in .git are read-only
and shutil.rmtree fails to remove them).
2016-06-11 11:47:48 +03:00
Peter Melnichenko
3eadfc5456 0.8.0 release 2016-06-07 11:46:40 +03:00
Peter Melnichenko
bf3fae2dfe Merge pull request #26 from starius/lua-5.3.3
add Lua 5.3.3
2016-06-07 12:34:49 +04:00
Peter Melnichenko
39d59eb05a Tests: don't rely on Lua 5.3.2 bugs being present in latest Lua 2016-06-07 11:29:31 +03:00
Boris Nagaev
d14b89262f add Lua 5.3.3 2016-06-07 01:41:52 +03:00
Peter Melnichenko
fb7181bfee 0.7.0 release 2016-05-03 19:52:22 +03:00
Peter Melnichenko
ef730fb24f Document --builds option 2016-05-03 17:32:18 +03:00
Peter Melnichenko
43c40e6c75 Fix incorrect target used when installing just LuaRocks on Windows
Use target from identifiers saved when installing Lua instead
of using target specified when installing LuaRocks.
2016-05-03 11:44:24 +03:00
Peter Melnichenko
75111b5064 Pass /F to LuaRocks install.bat to allow upgrading 2016-05-03 11:39:54 +03:00
Peter Melnichenko
78b4476c02 Attempt to fix random errors on Appveyor 2016-05-03 13:47:18 +03:00
Peter Melnichenko
fa0639f640 Always close all filehandles 2016-05-01 21:59:00 +03:00
Peter Melnichenko
1d184a0c14 Fix an extra @memoize 2016-05-01 21:21:24 +03:00
Peter Melnichenko
5752cf40b5 Try both amd64 and x86_amd64 VS setup scripts 2016-05-01 21:08:50 +03:00
Peter Melnichenko
2a98960a94 Fix setup_vs call 2016-05-01 21:08:30 +03:00
Peter Melnichenko
a438a1cfa0 Change how VS auto-setup targets work
* vs on x64: first try to set up tools for x64, then for x86
  using all VS verions instead of trying x64 for 11.0+ and x86
  for 9.0 and 10.0
* vs_32, vs_64: do setup even if cl.exe is present. That behaviour
  is only needed as a default.
2016-05-01 20:45:17 +03:00
Peter Melnichenko
bbc6080e2f Disable caching if relevant env vars are missing
Ref #24
2016-05-01 15:08:04 +03:00
Peter Melnichenko
53582de18d Fix test: clone luarocks only if it's missing 2016-05-01 14:37:27 +03:00
Peter Melnichenko
0780ddd950 Add mroe tests 2016-05-01 14:31:49 +03:00
Peter Melnichenko
dd10a136bd Move luarocks test repo location
For some reason deleting it from test/builds causes a permission
error on Windows even though it's created from the same nosetest
instance.
2016-04-30 20:57:32 +03:00
Peter Melnichenko
ba652ab780 Don't elevate luarocks installer on Windows if possible 2016-04-30 20:55:44 +03:00
Peter Melnichenko
c6599907dd Fix pep8 compliance 2016-04-30 20:36:45 +03:00
Peter Melnichenko
c279599665 Add a test 2016-04-30 20:31:48 +03:00
Peter Melnichenko
f3d5c10a93 Fix coverage upload on Appveyor
Don't use 'shallow_clone' in appveyor.yml, it causes
.git/ missing. Also remove an old caching option.
2016-04-30 16:49:29 +03:00
Peter Melnichenko
27649a3dc8 Appveyor: test a git command 2016-04-30 16:41:54 +03:00
Peter Melnichenko
9b095a46d5 Don't report coverage to coveralls.io on Appveyor for PRs
For coverage reporting on Appveyor it's necessary to set
COVERALLS_REPO_TOKEN env variable. For security reasons it's
not available when building pull requests, so don't call 'coveralls'
in that case. To compensate, always run 'coverage report'.
2016-04-30 16:15:55 +03:00
Peter Melnichenko
4cc9759aaf Fix tests for Windows 2016-04-30 11:04:10 +03:00
Peter Melnichenko
8ea50693c3 Refactoring of identifiers saving 2016-04-29 14:24:51 +03:00
Peter Melnichenko
835d70d3b7 Switch back to HTTP for Lua downloads
Https causes an error on a "real" Windows installation, but
not on Appveyor. Could be an issue with Python, Windows or
https implementation on www.lua.org. Safer to revert to http for now.
2016-04-29 14:18:12 +03:00
Peter Melnichenko
d13e49b0cf Save identifiers after installing Lua before installing LuaRocks
Fixes errors when reinstalling LuaRocks if the first attempt failed.
2016-04-28 12:50:34 +03:00
Peter Melnichenko
d04f34c71a Exit with error if a LuaRocks batch script is missing 2016-04-28 12:47:44 +03:00
Peter Melnichenko
115fc6a2fb Fix a test for Windows 2016-04-28 12:17:12 +03:00
Peter Melnichenko
062fa53184 Fix pip path for appveyor 2016-04-27 23:54:25 +03:00
Peter Melnichenko
6e37b10026 Fix appveyor matrix 2016-04-27 23:47:48 +03:00
Peter Melnichenko
c597a8d8aa Use nose on appveyor 2016-04-27 23:39:01 +03:00
Peter Melnichenko
b2b870c62e Don't run tests on Travis with Python 3.2
coverage.py doesn't support it.
2016-04-27 23:38:35 +03:00
Peter Melnichenko
0086cd3457 Port tests to nosetests 2016-04-27 23:27:02 +03:00
Peter Melnichenko
de368c98d8 Fix OS X build on Travis 2016-04-27 23:17:53 +03:00
Peter Melnichenko
155ebce687 Travis: Attempt to install pip on osx 2016-04-27 23:02:26 +03:00
mpeterv
1745496a07 Use plural/singular form of them/it for patches 2016-04-15 23:00:14 +03:00
mpeterv
15119a19b0 Fix minor version detection for Lua 5.1 2016-04-13 16:25:44 +03:00
mpeterv
44002eeb14 Test --patch 2016-04-12 17:18:17 +03:00
mpeterv
11e2fa78d0 Implement --patch 2016-04-12 17:17:28 +03:00
mpeterv
30866d911e Show python version in Appveyor 2016-04-06 19:52:30 +03:00
mpeterv
e6d7f168bd Test with Python 3.5 on Windows 2016-04-06 19:44:41 +03:00
mpeterv
defbc5c9cc Fix Python 3 compat when on Windows 2016-04-06 19:44:24 +03:00
Peter Melnichenko
dd2207126f Fix README 2 [ci skip] 2016-04-06 20:08:39 +04:00
Peter Melnichenko
66b31c80e7 Fix README [ci skip] 2016-04-06 20:04:30 +04:00
mpeterv
d3ff784117 Mention supported platforms in README [ci skip] 2016-04-06 18:59:14 +03:00
mpeterv
ff42be1ac9 Enable extensions before setting up MSVC
Apparently it's necessary when using setenv.cmd of WSDK.
2016-04-05 20:52:32 +03:00
mpeterv
d7472dd594 Show help for --downloads
It may be useful for caching on ci services, and seeing the
default value is nice.
2016-04-03 22:33:16 +03:00
mpeterv
c561c0bac3 Cache downloads on appveyor 2016-04-03 22:20:13 +03:00
mpeterv
bccbfbf626 Fix cmake generator arch suffix 2016-04-03 22:17:33 +03:00
mpeterv
882e414c0d Windows: configure LuaRocks to use correct cmake generator 2016-04-03 22:12:19 +03:00
mpeterv
9d65a349c9 Take Lua major version for LuaRocks from stored identifiers 2016-04-03 21:41:54 +03:00
mpeterv
24da318802 Add version to manifest
Increment when changing manifest format in breaking ways so that
upgrading hererocks doesn't result in a crash.
2016-04-03 21:19:44 +03:00
mpeterv
a1f4f47f2f Add 'latest' as an alias for '^' 2016-04-03 21:09:30 +03:00
mpeterv
b704246dc3 Implement --show option 2016-04-03 21:00:51 +03:00
mpeterv
d37aaf8e31 Use JSON to save identifiers 2016-04-03 20:23:44 +03:00
mpeterv
86b7f8fad9 Rename .source_kind == "fixed" -> .source == "release" 2016-04-03 19:40:08 +03:00
mpeterv
efc8301f5d Add vs_32 and vs_64 targets 2016-04-03 17:00:41 +03:00
mpeterv
b15e6db3a4 vs target: try older VS versions on x64 host but use x86 tools 2016-04-03 16:29:38 +03:00
mpeterv
be1c0a25fe Add vs08_64 and vs10_64 targets, fix help for --target 2016-04-03 16:14:21 +03:00
mpeterv
a18825c239 Pass x86_amd64 instead of amd64 to vcvarsall.bat 2016-04-03 16:04:52 +03:00
mpeterv
08a97da8b4 vs target: try VS versions in decreasing order 2016-04-03 16:02:36 +03:00
mpeterv
82097c458c Add vs target 2016-04-03 15:38:57 +03:00
mpeterv
fb26b06861 Handle missing programs 2016-04-03 15:15:40 +03:00
mpeterv
8dfda2b86b Make some methods static 2016-04-03 14:47:23 +03:00
mpeterv
f6e55110a2 Use raw strings for regexps 2016-04-03 14:43:19 +03:00
mpeterv
c976cb35a9 Fix an undefined variable 2016-04-03 14:40:16 +03:00
mpeterv
e7235d68b0 Don't run endlocal before recursive call 2016-04-03 14:30:11 +03:00
mpeterv
edc018cd07 Improve error handling and logging for VS setup 2016-04-03 14:24:11 +03:00
mpeterv
a6de9c000d Fix query_registry
Why didn't pyflakes detect this?
2016-04-03 13:47:08 +03:00
mpeterv
22ff2103af Improve VS setup command detection
Use registry keys and magic like install.bat in LuaRocks.
2016-04-03 13:41:58 +03:00
mpeterv
666aa79c36 Always show target on Windows 2016-04-02 13:42:07 +03:00
mpeterv
22491fe141 run(): print command as string on error 2016-04-02 13:41:04 +03:00
mpeterv
eb7f0d55fc Windows: replace cl target with vsXX_YY targets
When using vsXX_YY target, set up paths for Visual Studio 20XX
(YY bits) by writing a temporary batch file that calls appropriate
vcvarsall.bat and calls hererocks again, passing arguments through
another temporary file because escaping special batch characters
is difficult.

Related changes:
* Default target on Windows is now vs15_32, unless gcc is in PATH
  and cl.exe isn't.
* Fixed mingw LuaJIT build attempting to install lua51.lib which isn't built.
* Fixed list flatten in run(): consider unicode strings.
2016-04-02 13:18:10 +03:00
mpeterv
6fa4496a8c Mention possible targets in help message 2016-03-29 13:10:11 +03:00
mpeterv
3b116f5577 Handle failure to infer LUA_VERSION_NUM from lua.h 2016-03-29 13:06:54 +03:00
mpeterv
3eb06b5a7b Refactor git_branch_accepts_tags 2016-03-29 13:02:39 +03:00
mpeterv
b6e056a671 Install luarocks .bat files correctly for older versions 2016-03-28 20:57:10 +03:00
mpeterv
bf6026cb70 Copy luarocks.bat and luarocks-admin.bat into prefix/bin 2016-03-28 20:40:22 +03:00
mpeterv
d6b1704a72 Support cflags and compat=5.2 for LuaJIT with cl.exe 2016-03-28 20:15:39 +03:00
mpeterv
06f2e38f50 Use cflags instead of patching luaconf for compat
Gets rid of compiler warnings when a C module defines some
compatibility flags, e.g. luasocket.
2016-03-28 19:59:13 +03:00
mpeterv
2c41a94fcd Random changes 2016-03-28 19:21:25 +03:00
mpeterv
57a163fe07 Add .gitignore 2016-03-28 17:47:47 +03:00
mpeterv
ccbd07bf5d Use sys.exit instead of raise 2016-03-28 17:46:30 +03:00
mpeterv
097ce9a122 Rename/refactor command execution funcs 2016-03-28 17:44:33 +03:00
mpeterv
16f7945d7d Add appveyor badge [ci skip] 2016-03-28 15:37:04 +03:00
mpeterv
bae2f48940 Fix build on Windows 2016-03-28 15:30:16 +03:00
mpeterv
7200bebef8 Get rid of shell=True when running commands
Pass arguments as lists or nested lists.
2016-03-28 15:25:30 +03:00
mpeterv
8bf0633eab Print busted version on appveyor 2016-03-28 13:57:50 +03:00
mpeterv
8ddcb46f4e Install lua-term == 0.3
0.4 is broken on Windows.
2016-03-28 13:53:54 +03:00
mpeterv
d4733790e0 Install luarocks on travis 2016-03-28 13:41:58 +03:00
Peter Melnichenko
0283f075cb Merge pull request #16 from Lekensteyn/windows
Initial Windows port (mainly intended for easier Appveyor integration)
2016-03-28 14:24:46 +04:00
Peter Wu
b25cc45dbc pyflakes and pep8 fixes; python 2.7 compatibility
Yay... Python 2.7 does not support `def f(*args, shell=True)`.
Workaround by using **kwargs.
2016-03-27 13:20:41 +02:00
Peter Wu
7af7d9c7be Initial Windows port
Tested on Windows 7 x64 with MSVC12:

    "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
    hererocks.py C:\luatest -r^ --lua 5.3
    hererocks.py C:\luatest -r 2.2.2 --lua 5.2
    hererocks.py C:\luatest -r 2.0.10 --lua 5.1

Note:

 - LuaRocks <= 2.2.2 installs to $prefix\LuaRocks\2.2
 - LuaRocks >= 2.3 installs to $prefix\LuaRocks

TODO (for consistency with Linux): install to $prefix. Unfortunately
the Windows install.bat only offers the option to wipe $prefix before
installing, or aborting.
2016-03-26 16:14:43 +01:00
Peter Melnichenko
3552b040a1 Merge pull request #15 from Lekensteyn/fixes
Fix Python 3 compatibility on error
2016-03-26 16:29:44 +04:00
Peter Wu
21158d09a3 Fix Python 3 compatibility on error
This fixes a "TypeError: write() argument must eb str, not bytes" when
the compilation command fails.
2016-03-26 12:45:03 +01:00
mpeterv
528e8c2be7 0.6.2 release 2016-03-22 16:59:15 +03:00
mpeterv
79a577e72b 0.6.1 release 2016-03-22 16:53:53 +03:00
mpeterv
bad283179e Minor CLI doc fixes 2016-03-22 16:49:55 +03:00
mpeterv
75b6d57e4c Fix compatibility defines patching for Lua
Makefile is not used anymore, patches to luaconf.h for compatibility
defines should operate correctly with default defines not present
initially.
2016-03-22 16:47:53 +03:00
mpeterv
98f1426656 0.6.0 release 2016-03-20 23:34:26 +03:00
mpeterv
aaf90a918a Make tests verbose 2016-03-20 22:57:22 +03:00
mpeterv
52557f9e03 Attempt 3 to test on travis OS X 2016-03-20 22:45:34 +03:00
mpeterv
907e4cdd47 Attempt 2 to test on travis OS X 2016-03-20 22:37:29 +03:00
mpeterv
23d0adf4d9 Attempt to test on OS X on travis 2016-03-20 22:30:22 +03:00
mpeterv
fcea0f5140 Add --no-readline flag 2016-03-20 22:21:25 +03:00
mpeterv
fcc45f9b7a Support LuaJIT 2.1.0-beta1 and 2.1.0-beta2
`hererocks -j 2.1` now installs LuaJIT 2.1.0-beta2. To get old
behaviour use `-j @v2.1`.
2016-03-20 21:18:54 +03:00
mpeterv
d0ec9237e5 Use fixed tag when fetching LuaJIT 2.0.1 2016-03-20 21:07:09 +03:00
mpeterv
721b2c467b Replace distutils.spawn.find_executable
It's not always available on Windows apparently.
2016-03-20 20:30:17 +03:00
mpeterv
f4139453df Use HTTPS when fetching Lua 2016-03-20 20:15:38 +03:00
mpeterv
b9c050bb14 Add an option to turn checksum mismatches into warnings
Leaves an option to not break if something changes upstream.
2016-03-20 19:38:09 +03:00
mpeterv
ebd42a91a0 Tweak checksum verification
* Assume that all versions have checksums
* Don't print the checksum if it matched
2016-03-20 19:25:43 +03:00
mpeterv
e65c2c14e9 Don't warn about checksum when using cached git repos 2016-03-20 19:24:38 +03:00
mpeterv
d290832551 Add pep8 config: relax line length limit and ignore E203 2016-03-20 17:44:29 +03:00
Peter Melnichenko
f05451124c Merge pull request #13 from starius/verify-downloads
Verify downloads
2016-03-20 18:37:01 +04:00
Boris Nagaev
3452d6e4aa verify checksums of downloaded files if possible 2016-03-20 16:44:27 +03:00
Boris Nagaev
fe8c16bc7c rename cached files as distribution tarballs
Example: lua5.3.2 -> lua-5.3.2.tar.gz
2016-03-20 16:33:45 +03:00
mpeterv
13e45c9db0 Build LuaJIT with cl on appveyor 2016-03-02 19:08:31 +03:00
mpeterv
2a45fc7980 Don't attempt to install libluajit.so on Windows 2016-03-02 19:02:36 +03:00
mpeterv
87ddca66bd Autodetect mingw32-make 2016-03-02 18:58:35 +03:00
mpeterv
2019ef4f65 Autodetect cl target under Windows 2016-03-02 18:58:35 +03:00
mpeterv
9315a91b2e Don't show "5.1" as LuaJIT version when installing from local dir 2016-03-02 18:58:35 +03:00
Peter Melnichenko
d289eaf784 Merge pull request #12 from starius/add-luajit-h
luajit targets: install luajit.h
2016-02-28 15:03:03 +03:00
Boris Nagaev
184c2ca6b2 luajit targets: install luajit.h
fix #11
2016-02-28 14:08:00 +03:00
mpeterv
31c64145f4 Don't link lua.obj when building luac.exe 2016-02-27 20:12:25 +03:00
mpeterv
f5ebed80ae Fix cl build 2016-02-27 20:06:45 +03:00
mpeterv
9c0b3c64ac Test cl.exe RioLua build on Appveyor 2016-02-27 20:02:44 +03:00
mpeterv
8f8bbb6829 Support --target=cl for RioLua 2016-02-27 19:39:03 +03:00
mpeterv
875276d3f5 Another build bites the dust 2016-02-27 18:44:13 +03:00
mpeterv
20cd7081e7 Don't ar rcu poor lua.o 2016-02-27 18:38:44 +03:00
mpeterv
1c49031209 Fix MinGW RioLua build, again 2016-02-27 18:30:02 +03:00
mpeterv
95945c6c23 Fix duplicated LUA_BUILD_AS_DLL flag under MinGW 2016-02-27 18:27:36 +03:00
mpeterv
68e4d8ccee Test RioLua build on Appveyor 2016-02-27 18:23:26 +03:00
mpeterv
93463a2493 Build RioLua manually 2016-02-27 18:17:18 +03:00
mpeterv
2163985302 README.md: point download link to latest branch [ci skip] 2016-02-27 16:09:08 +03:00
Peter Melnichenko
fd2aba2a92 Merge pull request #9 from starius/fix-typo
fix typo in README
2016-02-18 21:56:51 +03:00
Boris Nagaev
7a076d3c11 fix typo in README 2016-02-18 21:35:51 +03:00
mpeterv
07cc7f17db 0.5.0 release 2016-01-11 19:50:45 +03:00
mpeterv
911be4bd52 Support LuaRocks 2.3.0 2016-01-11 19:46:43 +03:00
mpeterv
acfcfdf347 0.4.0 release 2016-01-03 15:48:31 +03:00
mpeterv
886f1f5969 Mention --no-git-cache in hererocks help 2016-01-03 15:04:01 +03:00
mpeterv
6dae2ebf91 Don't use sed for patching Makefile
'-i' isn't portable, use Python instead.

Fixes #7.
2016-01-03 14:57:43 +03:00
mpeterv
055dd7c8f4 0.3.1 release 2015-12-22 13:36:41 +03:00
mpeterv
a2975812e2 Download luajit from github mirror 2015-12-22 13:33:23 +03:00
mpeterv
081f713bf7 0.3.0 release 2015-12-19 16:35:56 +03:00
mpeterv
f23ed95c4c Remove --apicheck, add --cflags 2015-12-19 16:29:10 +03:00
mpeterv
05c37d9a85 Install LuaJIT .so library 2015-12-08 12:08:45 +03:00
mpeterv
57029cd66a Fix installation of LuaJIT static lib
Install into lib/libluajit-5.1.a instead of ./liblua.a
2015-12-08 12:01:27 +03:00
mpeterv
0d13277c0f Do not pass PREFIX when building LuaJIT
Since default paths are patched, there is no point.
2015-12-06 15:14:50 +03:00
mpeterv
b017fbc4be Install LuaJIT manually 2015-12-06 15:14:49 +03:00
mpeterv
62f94dab1b Fix cached builds
Copy files when installing, not move them (don't break cache).
2015-12-06 15:14:49 +03:00
mpeterv
f799ad3b14 Add pseudo target 'cl' for Windows using cl.exe
Use it only for LuaJIT for now.
2015-12-05 20:27:10 +03:00
mpeterv
20a64af4bc Install Rio Lua manually
For some reason 'make install' does not work on Windows? Or maybe
something could be wrong with running two MinGW installations on top
of a broken Cygwin installation on top of Windows XP...
2015-12-05 20:17:12 +03:00
mpeterv
41210f593d Use Unix newlines when patching luaconf.h 2015-12-05 19:59:40 +03:00
mpeterv
a9050e0759 Do not cache git repos on travis
Git logs stuff which causes cache invalidation.
2015-12-04 21:30:05 +03:00
mpeterv
1236a48a40 Fix Python 3 compat 2015-12-04 21:21:00 +03:00
mpeterv
09a59b5ff0 Cache default git repos 2015-12-04 21:17:05 +03:00
mpeterv
2deeec1a00 Fix installation of LuaJIT jit.* modules 2015-12-04 17:45:58 +03:00
mpeterv
2efa014352 Silence pep8 2015-12-04 15:20:22 +03:00
mpeterv
4b9056364d Show non-default values for --target and --apicheck 2015-12-04 15:17:31 +03:00
mpeterv
e71df9c433 Add --apicheck flag enabling LUA_USE_APICHECK 2015-12-04 15:10:04 +03:00
mpeterv
30d24d065b Don't cache all builds when testing 2015-12-04 14:53:10 +03:00
mpeterv
1c482970a6 Patch luaconf.h instead of Makefile for compat defines 2015-12-04 14:52:27 +03:00
mpeterv
fa2e34905b Add more tests and move them to a script 2015-12-04 13:44:21 +03:00
mpeterv
042aa8a803 Add support for LuaRocks 2.0.8 - 2.0.12 2015-12-04 13:07:03 +03:00
mpeterv
534766560d Silence pep8 2015-12-04 00:32:07 +03:00
mpeterv
468a7ad8bf Add --compat=none for Lua 5.1
Undefines LUA_COMPAT_VARARG, LUA_COMPAT_MOD, LUA_COMPAT_LSTR,
LUA_COMPAT_GFIND, and LUA_COMPAT_OPENLIB before compiling.
2015-12-04 00:29:20 +03:00
mpeterv
5466fca58f Update help message 2015-12-04 00:18:12 +03:00
mpeterv
13a8bb4bb2 0.2.0 release 2015-12-02 12:26:58 +03:00
mpeterv
1599b207ff Show versions to be installed 2015-12-02 12:14:19 +03:00
mpeterv
9dfa3e15e0 Add support for Lua 5.3.2 2015-12-02 11:55:09 +03:00
15 changed files with 2426 additions and 306 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
*.pyc
*.egg-info
dist
.coverage
test/here
test/builds
test/luarocks

View File

@ -1,30 +1,22 @@
language: python
sudo: false
cache:
directories: cache
python:
- "2.7"
- "3.2"
- "3.5"
matrix:
include:
- os: linux
sudo: false
python: 2.7
- os: linux
sudo: false
python: 3.5
- os: osx
language: generic
install:
- pip install pyflakes
- pip install pep8
- 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
script:
- pyflakes .
- pep8 . --max-line-length 99 --ignore E302
- python hererocks.py here -l 5.3 -r^ --downloads cache --builds cache
- export PATH=$PATH:$PWD/here/bin
- lua -v
- luarocks --version
- luarocks make
- hererocks-test
- rm here -r
- python hererocks.py here -j 2.1 -r^ --downloads cache --builds cache
- lua -v
- luarocks --version
- luarocks make
- hererocks-test
- pycodestyle .
- nosetests
- coveralls

243
CHANGELOG.md Normal file
View 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.

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Peter Melnichenko
Copyright (c) 2015 - 2017 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

View File

@ -1,64 +1,117 @@
hererocks
=========
.. image:: https://travis-ci.org/mpeterv/hererocks.svg?branch=master
.. |travis| image:: https://travis-ci.org/mpeterv/hererocks.svg?branch=master
:target: https://travis-ci.org/mpeterv/hererocks
``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.
.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/85mocuaej4owyifj?svg=true
:target: https://ci.appveyor.com/project/mpeterv/hererocks
|travis| |appveyor|
``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.
Basic usage
-----------
.. code-block:: bash
hererocks lua53 -l5.3 -rlatest # Install Lua 5.3 with latest LuaRocks into 'lua53' directory.
source lua53/bin/activate # Run activation script, adding 'lua53/bin' to $PATH.
lua -v # Lua, LuaRocks, and programs
luarocks install luacheck # installed using LuaRocks
luacheck --version # can now be used.
deactivate-lua # Remove 'lua53/bin' from $PATH.
lua53/bin/lua -v # All the binaries can still be used directly.
For more info see below or run ``hererocks --help`` for a complete listing of options.
Installation
------------
Using `pip <https://pypi.python.org/pypi/pip>`_: run ``pip install hererocks``, using ``sudo`` if necessary.
Manually: download hererocks with ``wget https://raw.githubusercontent.com/mpeterv/hererocks/0.1.0/hererocks.py``, then use ``python hererocks.py ...`` to run it.
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 systems: ``gcc``.
Activation scripts
------------------
``hererocks`` writes several activation scripts into ``bin`` subdirectory of the installation directory.
When sourced (on Windows: simply executed) they add path to that subdirectory to ``PATH`` environment variable.
This allows one to use ``lua``, ``luarocks`` and other programs installed in the created environment directly.
Additionally, activation scripts make ``deactivate-lua`` command available. It removes path to currently activated
environment from ``PATH``. Activating an environment deactivates the previous one automatically, if it exists.
Several versions of activation scripts are installed to support various shells:
* Windows:
* Batch: ``activate.bat``.
* PowerShell: ``activate.ps1``.
* Other systems:
* Bash, Zsh, Dash: ``activate``.
* Fish: ``activate.fish``.
* Tcsh, csh: ``activate.csh``.
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``. ``^`` can be used to select the latest stable version. ``hererocks`` will fetch and unpack sources of the selected version from corresponding official downloads location.
* 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 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-beta3``. ``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/luarocks/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.
Compatibility flags
^^^^^^^^^^^^^^^^^^^
Lua and LuaJIT have some flags that add compatibility with other Lua versions. Lua 5.2 has 5.1 compatibility flag (on by default), Lua 5.3 - both 5.1 and 5.2 compatibility flags (only 5.2 compatibility is on by default), and LuaJIT has 5.2 flag (off by default). ``hererocks`` can change these flags before building when using ``--compat`` option. Possible arguments are ``default``, ``none``, ``all``, ``5.1`` and ``5.2``.
Lua and LuaJIT have some flags that add compatibility with other Lua versions. Lua 5.1 has several options for compatibility with Lua 5.0 (on by default), Lua 5.2 has 5.1 compatibility flag (on by default), Lua 5.3 - both 5.1 and 5.2 compatibility flags (only 5.2 compatibility is on by default), and LuaJIT has 5.2 flag (off by default). ``hererocks`` can change these flags before building when using ``--compat`` option. Possible arguments are ``default``, ``none``, ``all``, ``5.1`` and ``5.2``.
Installing standard PUC-Rio Lua
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Available versions: 5.1 - 5.1.5, 5.2.0 - 5.2.4, 5.3.0 - 5.3.1.
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.
When building Lua, ``hererocks`` tries to use sensible ``make`` target. The default can be seen in the help message printed by ``hererocks --help``. To select another target, use ``--target`` 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
^^^^^^^^^^^^^^^^^
Available versions: 2.0.0 - 2.0.4, 2.1 (installs from ``v2.1`` branch of the LuaJIT git repository).
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
^^^^^^^^^^^^^^^^^^^
Available versions: 2.1.0 - 2.1.2, 2.2.0 - 2.2.2, 3 (installs from ``luarocks-3`` 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``.
Versions 2.1.0 - 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.
Using hererocks to set up automated testing
-------------------------------------------
@ -67,8 +120,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"
@ -79,15 +133,38 @@ 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.
- source env/bin/activate # 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=C:\Python27\Scripts;%PATH% # Add directory containing 'pip' to PATH
- pip install hererocks
- hererocks env --%LUA% -rlatest
- call env\bin\activate
- luarocks install busted
build_script:
- luarocks make
test_script:
- busted

17
appveyor.yml Normal file
View File

@ -0,0 +1,17 @@
version: 1.0.{build}
environment:
matrix:
- Python: 35-x64
- Python: 27
build_script:
- PATH %CD%\here\bin;C:\mingw\bin;C:\python%Python%;C:\python%Python%\scripts;%PATH%
- pip install pyflakes pycodestyle coverage coveralls nose
test_script:
- pyflakes .
- pycodestyle .
- nosetests
- coverage report
- if not "%COVERALLS_REPO_TOKEN%"=="" coveralls

File diff suppressed because it is too large Load Diff

2
setup.cfg Normal file
View File

@ -0,0 +1,2 @@
[pycodestyle]
ignore = E203,E302,E305,E501

View File

@ -9,7 +9,7 @@ readme.close()
setuptools.setup(
name="hererocks",
version="0.1.0",
version="0.20.0",
description="Tool for installing Lua and LuaRocks locally",
long_description=long_description,
keywords="lua",
@ -18,7 +18,7 @@ setuptools.setup(
author_email="mpeterval@gmail.com",
license="MIT",
classifiers=[
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
@ -28,7 +28,9 @@ setuptools.setup(
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5"
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7"
],
py_modules=["hererocks"],
entry_points={

21
test/check_activate.bat Normal file
View File

@ -0,0 +1,21 @@
@echo off
echo "initial: %PATH%"
call "test\here\bad (dir) 1\bin\activate"
echo "activate 1: %PATH%"
call deactivate-lua
echo "deactivate 1: %PATH%"
call "test\here\bad (dir) 1\bin\activate"
echo "activate 1 again: %PATH%"
call "test\here\bad (dir) 1\bin\activate"
echo "reactivate 1: %PATH%"
call "test\here\bad (dir) 2\bin\activate"
echo "activate 2: %PATH%"
call deactivate-lua
echo "deactivate 2: %PATH%"

20
test/check_activate.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
echo "initial: $PATH"
source "test/here/bad (dir) 1/bin/activate"
echo "activate 1: $PATH"
deactivate-lua
echo "deactivate 1: $PATH"
source "test/here/bad (dir) 1/bin/activate"
echo "activate 1 again: $PATH"
source "test/here/bad (dir) 1/bin/activate"
echo "reactivate 1: $PATH"
source "test/here/bad (dir) 2/bin/activate"
echo "activate 2: $PATH"
deactivate-lua
echo "deactivate 2: $PATH"

156
test/cli_test.py Normal file
View File

@ -0,0 +1,156 @@
import os
import shutil
import subprocess
import time
import unittest
class TestCLI(unittest.TestCase):
@classmethod
def setUpClass(cls):
subprocess.check_call(["coverage", "erase"])
def setUp(self):
if os.name == "nt":
# On Windows tests randomly fail here with errors such as 'can not remove here\bin: directory not empty'.
# Supposedly this happens because a file in the directory is still open, and on NFS
# deleting an open file leaves a file in the same directory. Waiting before attempting
# to remove directories seems to help.
time.sleep(1)
for subdir in ["here", "builds"]:
if os.path.exists(os.path.join("test", subdir)):
shutil.rmtree(os.path.join("test", subdir))
def assertSuccess(self, args, expected_output_lines=None, from_prefix=True):
if from_prefix:
args[0] = os.path.join("test", "here", "bin", args[0])
if os.name == "nt" and not os.path.exists(args[0]) and not os.path.exists(args[0] + ".exe"):
args[0] += ".bat"
process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = process.communicate()[0]
if process.returncode != 0:
raise AssertionError("Error running command '{}': code {}, output:\n{}".format(
" ".join(args), process.returncode, output))
if expected_output_lines is not None:
actual_output_lines = output.splitlines()
for expected_output_line in expected_output_lines:
expected_output_line = expected_output_line.encode("UTF-8")
if not any(expected_output_line in actual_output_line for actual_output_line in actual_output_lines):
raise AssertionError("Expected to see '{}' in output of command '{}', got output:\n{}".format(
expected_output_line, " ".join(args), output))
def assertHererocksSuccess(self, args, expected_output_lines=None, location="here"):
self.assertSuccess([
"coverage", "run", "-a",
"hererocks.py", os.path.join("test", location)] + args, expected_output_lines, from_prefix=False)
def test_install_latest_lua_with_latest_luarocks(self):
self.assertHererocksSuccess(["--lua", "latest", "--luarocks", "latest"])
self.assertHererocksSuccess(["--show"], ["Programs installed in", "Compat: default"])
self.assertSuccess(["lua", "-v"], ["Lua 5.3.5"])
self.assertSuccess(["lua", "-e", "assert(bit32)"])
self.assertSuccess(["luarocks", "--version"])
self.assertSuccess(["luarocks", "make", os.path.join("test", "hererocks-test-scm-1.rockspec")])
self.assertSuccess(["hererocks-test"], ["Lua 5.3"])
self.assertHererocksSuccess(["--lua", "latest", "--luarocks", "latest"], ["already installed"])
self.assertHererocksSuccess(["--luarocks", "latest", "--ignore-installed"], ["Fetching", "cached"])
def test_install_latest_lua_with_luarocks_from_git(self):
self.assertHererocksSuccess(["--lua", "latest", "--luarocks", "https://github.com/mpeterv/luarocks@master"])
def test_install_lua_from_git_with_latest_luarocks(self):
self.assertHererocksSuccess(["--lua", "@b1daa06", "--luarocks", "latest"])
self.assertHererocksSuccess(["--show"], ["Programs installed in", "cloned from https://github.com/lua/lua"])
self.assertSuccess(["luarocks", "--version"])
def test_verbose_install_bleeding_edge_luajit_with_latest_luarocks(self):
self.assertHererocksSuccess(["--luajit", "@v2.1", "--luarocks", "latest", "--verbose"])
self.assertSuccess(["lua", "-v"], ["LuaJIT 2.1.0"])
self.assertSuccess(["lua", "-e", "require 'jit.bcsave'"])
self.assertSuccess(["luarocks", "--version"])
self.assertSuccess(["luarocks", "make", os.path.join("test", "hererocks-test-scm-1.rockspec")])
self.assertSuccess(["hererocks-test"], ["LuaJIT 2.1.0"])
self.assertHererocksSuccess(["--luajit", "@v2.1", "--luarocks", "latest"], ["already installed"])
self.assertHererocksSuccess(["--show"], ["cloned from https://github.com/LuaJIT/LuaJIT"])
def test_install_lua_5_1_without_compat_without_readline_with_old_luarocks(self):
self.assertHererocksSuccess(["--lua", "5.1", "--compat", "none", "--no-readline", "--luarocks", "2.0.8"])
self.assertSuccess(["lua", "-e", "assert(not pcall(string.gfind, '', '.'))"])
self.assertSuccess(["lua", "-e", "(function(...) assert(arg == nil) end)()"])
self.assertSuccess(["lua", "-e", "assert(math.mod == nil)"])
self.assertSuccess(["luarocks", "--version"])
self.assertSuccess(["luarocks", "make", os.path.join("test", "hererocks-test-scm-1.rockspec")])
def test_install_lua_5_3_2_with_patches(self):
self.assertHererocksSuccess(["--lua", "5.3.2", "--patch"])
self.assertSuccess(["lua", "-e", "assert(coroutine.wrap(string.gmatch('x', '.'))() == 'x')"])
if os.name == "nt":
self.assertHererocksSuccess(["--lua", "5.3.2", "--patch", "--target", "vs"])
self.assertSuccess(["lua", "-e", "assert(coroutine.wrap(string.gmatch('x', '.'))() == 'x')"])
def test_install_luajit_with_compat_with_apicheck(self):
self.assertHererocksSuccess(["--luajit", "latest", "--compat", "5.2", "--cflags=-DLUA_USE_APICHECK"])
if os.name == "nt":
self.assertHererocksSuccess([
"--luajit", "latest", "--compat", "5.2", "--cflags=-DLUA_USE_APICHECK", "--target", "vs"])
def test_cached_lua_5_2_build(self):
self.assertHererocksSuccess(
["--lua", "5.2", "--builds", os.path.join("test", "builds")],
["No patches available for Lua 5.2"])
self.assertHererocksSuccess(
["--lua", "5.2", "--compat", "none", "--builds", os.path.join("test", "builds")],
["No patches available for Lua 5.2"])
self.assertHererocksSuccess(
["--lua", "5.2", "--ignore-installed", "--compat", "none", "--builds", os.path.join("test", "builds")],
["compat: none) (cached)"])
def test_install_lua_5_2_with_luarocks_from_local_sources(self):
local_luarocks = os.path.join("test", "luarocks")
if not os.path.exists(local_luarocks):
self.assertSuccess([
"git", "clone", "https://github.com/keplerproject/luarocks",
"--depth=1", local_luarocks], from_prefix=False)
self.assertHererocksSuccess(["--lua", "5.2", "--luarocks", local_luarocks])
self.assertHererocksSuccess(["--show"], ["from local sources"])
def test_activate_scripts(self):
self.assertHererocksSuccess(["--lua", "5.1"], location=os.path.join("here", "bad (dir) 1"))
self.assertHererocksSuccess(["--lua", "5.2"], location=os.path.join("here", "bad (dir) 2"))
checker = os.path.join("test", "check_activate." + ("bat" if os.name == "nt" else "sh"))
path = os.getenv("PATH")
path1 = os.path.abspath(os.path.join("test", "here", "bad (dir) 1", "bin"))
path2 = os.path.abspath(os.path.join("test", "here", "bad (dir) 2", "bin"))
self.assertSuccess([checker], [
"initial: {}".format(path),
"activate 1: {}{}{}".format(path1, os.pathsep, path),
"deactivate 1: {}".format(path),
"activate 1 again: {}{}{}".format(path1, os.pathsep, path),
"reactivate 1: {}{}{}".format(path1, os.pathsep, path),
"activate 2: {}{}{}".format(path2, os.pathsep, path),
"deactivate 2: {}".format(path)
], from_prefix=False)
def test_install_lua_5_4_with_luarocks_3(self):
self.assertHererocksSuccess(["--lua", "5.4", "--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"])

View File

@ -15,11 +15,11 @@ dependencies = {
build = {
type = "builtin",
modules = {
["hererocks.test"] = "test.lua"
["hererocks.test"] = "test/test.lua"
},
install = {
bin = {
["hererocks-test"] = "hererocks-test.lua"
["hererocks-test"] = "test/hererocks-test.lua"
}
},
copy_directories = {}