How can I install lua rocks from a manifest file? - luarocks

I come from a python background and I'm hoping to do something semantically equivalent to pip install -r requirements.txt to install a list of Python packages at the right version.
Is this achievable with luarocks? If not, is there a way to hack this together on the command line?

The system in Lua is a little different. There is a rockspec manifest file associated with every package. You can list your package dependencies here in this file and you can install then using
"luarocks install name.rockspec".
For more details, visit Luarocks
More on Rockspec format here
Instruction for creating a package/rock here

In case you just want to install a list of dependencies from a file without worrying about Rockspec, you can also just use this three lines that read a file with the exact same format of a requirements.txt file for pip (package==version):
while read -r line ; do
luarocks install $(echo $line | awk -F '==' '{print $1, $2}')
done < lua_requirements.txt

Related

How to create a PDF-out-of-Sphinx-documentation-tool

Followed this link to try and generate pdf from Sphinx:
https://www.quora.com/How-to-create-a-PDF-out-of-Sphinx-documentation-tool
$ sphinx-build -b pdf source build/pdf
Error: Cannot find source directory `/Users/seb/mydocs/source'.
$ make all-pdf
make: *** No rule to make target `all-pdf'. Stop.
$ make pdf
make: *** No rule to make target `pdf'. Stop.
Since tried in OSX:
$ conda install -c dfroger rst2pdf=0.93
Fetching package metadata .........
Solving package specifications: .
Error: Package missing in current osx-64 channels:
- rst2pdf 0.93*
You can search for packages on anaconda.org with
anaconda search -t conda rst2pdf
EDIT:
After pip install rst2pdf
install rst2pdf
register rst2pdf in your conf.py Sphinx config
extensions = ['sphinx.ext.autodoc','rst2pdf.pdfbuilder']
But adding 'rst2pdf.pdfbuilder' causes
Extension error:
Config value 'math_number_all' already present
make: *** [html] Error 1
$ sphinx-build -bpdf sourcedir outdir
But what do I specify as sourcedir and outdir? Example please.
EDIT:
Now after make html
and then:
$ rst2pdf index.rst output.pdf
index.rst:14: (ERROR/3) Unknown directive type "toctree".
.. toctree::
:maxdepth: 2
introduction
tutorial
multiple_jobs
deployment
project
index.rst:26: (ERROR/3) Unknown interpreted text role "ref".
index.rst:27: (ERROR/3) Unknown interpreted text role "ref".
index.rst:28: (ERROR/3) Unknown interpreted text role "ref".
Also:
$rst2pdf.py index.rst -o mydocument.pdf
Does produce a mydocument.pdf but completely different from html and toc to all the pages are not even there?
Image of pdf verse HTML same page
This is from the official Sphinx documentation. If you have pdfTex tool installed in your machine, all you need is:
$ make latexpdf
Then, the generated pdf file(s) will be under _build/latex/<PROJECT-NAME>.pdf
So, the complete process from scratch would be as follows:
$ pip install -U sphinx # install the package
$ sphinx-quickstart # create a new project (answer the questions)
$ make latexpdf # compile and generate pdf file
Note that you may also "optionally" install whatever extensions needed by editing the file config.py
NOTE: This answer assumes LaTeX engine is installed on your machine.
I have succeeded in generating a PDF file for the DevStack document by following the configuration changes in this link:
Here are the steps:
Edit your conf.py (edit or append values)
extensions = ['rst2pdf.pdfbuilder']
pdf_documents = [('index', u'rst2pdf', u'Sample rst2pdf doc', u'Your Name'),]
Install the "rst2pdf" if necessary
pip install rst2pdf
Build the PDF file like this:
sphinx-build -b pdf doc/source doc/build
Succeeded in Pdf Generation via Latex (for windows 10)... No need to change existing conf.py file in Sphinx... the best solution is install MiKTeX....install Perl (ActiveState).... after when running sphinx type 'make HTML' type 'make latex' and then make latexPdf... this solved my issue.
You could avoid rst2pdf and use make pdflatex to build pdf output via a latex file.
cf more info:
https://docs.typo3.org/typo3cms/extensions/sphinx/AdvancedUsersManual/RenderingPdf/
Make sure to have a look at http://rst2pdf.ralsina.me/handbook.html#sphinx.
Following applies to Ubuntu 16.
But it is probably less painful to install a full LaTex suite than to try to get this tool running; it is very sensitive to errors, and is difficult to use.
I took a look there (https://tex.stackexchange.com/a/95373) and it looks daunting...
this is more encouraging: https://milq.github.io/install-latex-ubuntu-debian/
And I did it:
sudo apt-get install texlive-full
make clean latexpdf
is worthwhile your patience (and disk space) to install. I got rid of rst2pdf.
Found this related post which discovers that rst2pdf breaks math rendering in Sphinx 1.4.1 because it imports a dummy math module.
In rst2pdf.pdfbuilder:setup(), it calls mathbase.setup() internally to install dummy math module. It causes conflicts and raise errors.
I had this same error when running sphinx-build -b pdf
Extension error:
Config value 'math_number_all' already present
Now looking at latex option, and exporting to pdf as #tfv posted. pdflatex is a larger universe of TeX distribution.
As an alternative to latexpdf: rinohtype
Once rinohtype is installed, sphinx-build -b rinoh . _build
Create a file documentation.md, and open it in Typora software. Navigate to the Sphynx documentation that you need, mark with mouse and copy inside Typora. Then inside typora export as PDF. Done.

Official Fedora package for 'xxd' command?

I need to use a script based upon xxd, but it's not installed on my Fedora 21:
$ xxd
bash: xxd: command not found
So I tried without success to search and install it:
$ yum install xxd
(fails)
$ yum search xxd
(fails)
$ yum search all xxd
(fails - detailed log below)
Loaded plugins: langpacks
================================================================= Matched: xxd ========
perl-Data-HexDump-XXD.noarch : Format hexadecimal dump like xxd
xxdiff.i686 : Graphical file and directories comparator and merge tool
xxdiff-tools.i686 : Tools for xxdiff
Do you know which package xxd is provided with? (I mean an official package to install with yum from the fedora repositories).
Thanks in advance for any help!
xxd is in the vim-common package.
You can find that by using yum whatprovides '*bin/xxd'.
Have you tried
yum install vim-common

Autoconf macros for Apache and conf.d install process?

I have a package that is using the autotools to build and install.
Part of the package is a website that can be run on the local machine.
So in the package there is a .conf file that is meant to be either
copied or linked to the /etc/apache2/conf.d directory. What's the
standard way that packages would do this? If possible, I'd like for
the user not to have an extra step to make the website work. I'd like
to have them install the package and then be able to browse to
http://localhost/newpackage to get up and running.
Also, is there a way that autoconf knows about the apache install or a
standard way through then environment some how? If someone could
point me in the right direction that would be great.
Steve
The first thing you should do is to locate the apache extension tool apxs or apxs2 (depends on apache version and/or platform you are building for). After you know where your tool is located you can run queries to get certain apache config params. For example to get system config dir you can run:
apxs2 -q SYSCONFDIR
Here is a snippet of how you can locate apache extension tool: (be careful it may contain syntax errors)
dnl Note: AC_DEFUN goes here plus other stuff
AC_MSG_CHECKING(for apache APXS)
AC_ARG_WITH(apxs,
[AS_HELP_STRING([[--with-apxs[=FILE]]],
[path to the apxs, defaults to "apxs".])],
[
if test "$withval" = "yes"; then
APXS=apxs
else
APXS="$withval"
fi
])
if test -z "$APXS"; then
for i in /usr/sbin /usr/local/apache/bin /usr/bin ; do
if test -f "$i/apxs2"; then
APXS="$i/apxs2"
break
fi
if test -f "$i/apxs"; then
APXS="$i/apxs"
break
fi
done
fi
AC_SUBST(APXS)
The way to use APXS in your automake Makefile.am would look something like this:
## Find apache sys config dir
APACHE2_SYSCONFDIR = `#APXS# -q SYSCONFDIR`
## Misc automake stuff goes here
install: install-am
cp my.conf $(DESTDIR)${APACHE2_SYSCONFDIR}/conf.d/my.conf
I assume you are familiar with automake and autoconf tools.

Running script in FreeBSD

First steps in FreeBSD: trying to run my installation script. Fast help needed:
# ls
configure
# file configure
configure: Bourne-Again shell script text executable
# ./configure
./configure: Command not found
# configure
configure: Command not found
What is wrong, how can I execute this script?
Do you have bash installed? If not use FreeBSD Ports to install it. Use where bash to find out.
Use the force Luke :)
# pkg_add -r bash
May it be, that your's configure script doesn't have appropriate executions rights. Try to cast:
chmod 777 configure
If it works, fix it to
chmod 764 configure
configure scripts are ultra portable shell scripts. There is no need for bash here. The problem is somewhere else.
What's the first line in the configure script? Maybe a CR/LF snuck in, which is a common cause for a totally misleading error message saying that the script was not found, when it was the interpreter that was not found.
Please try /bin/sh ./configure
Install the bash package using
pkg add bash
or
make -C /usr/ports/shells/bash install clean
By default FreeBSD comes with tcsh and a POSIX compatible FreeBSD sh
On older FreeBSD systems you will need to do
rehash
before you can run it.
First line of this script (#!/usr/bin/bash, i suppose) should be changed to #!/usr/local/bin/bash.
And of course, you should have shells/bash port installed.

Uninstall Mono from Mac OS X v10.5 Leopard

I installed Mono on my iMac last night and I immidiately had a change of heart! I don't think Mono is ready for prime time.
The Mono website says to run the following script to uninstall:
#!/bin/sh -x
#This script removes Mono from an OS X System. It must be run as root
rm -r /Library/Frameworks/Mono.framework
rm -r /Library/Receipts/MonoFramework-SVN.pkg
cd /usr/bin
for i in `ls -al | grep Mono | awk '{print $9}'`; do
rm ${i}
done
Has anyone had to uninstall Mono? Was it as straight forward as running the above script or do I have to do more? How messy was it? Any pointers are appreciated.
The above script simply deletes everything related to Mono on your system -- and since the developers wrote it, I'm sure they didn't miss anything :) Unlike some other operating systems made by software companies that rhyme with "Macrosoft", uninstalling software in OS X is as simple as deleting the files, 99% of the time.. no registry or anything like that.
So, long story short, yes, that script is probably the only thing you need to do.
Year 2017 answer for those, like myself, looking at SE first and official docs later (FYI I know the question was for OS Leopard). Run these commands in the terminal:
sudo rm -rf /Library/Frameworks/Mono.framework
sudo pkgutil --forget com.xamarin.mono-MDK.pkg
sudo rm -rf /etc/paths.d/mono-commands
Seems the uninstall script has been slightly modified as today (2011-07-12):
#!/bin/sh -x
#This script removes Mono from an OS X System. It must be run as root
rm -r /Library/Frameworks/Mono.framework
rm -r /Library/Receipts/MonoFramework-*
for dir in /usr/bin /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man5; do
(cd ${dir};
for i in `ls -al | grep /Library/Frameworks/Mono.framework/ | awk '{print $9}'`; do
rm ${i}
done);
done
You can find the current version here.
By the way: it's the same exact thing that runs the uninstaller mentioned by joev (although as jochem noted it is not located in the /Library/Receipts, it must be found in the installation package=.
To expand on feelingsofwhite.com's answer, the Mono installer for Mac OS puts the uninstall script in the /Library/Receipts directory, not in the installer image as it says in the Notes.rtf file. The Receipts directory is what the Mac OS Installer.app uses to keep track of which packages were responsible for installing which files. Usually, a list of these is kept in a .bom ("Bill of Materials") file, which can be explored with the lsbom command.
In the case of Mono, they also add a whole bunch of links from your /usr/bin and man directories. Their uninstall scripts finds these and removes them. Since the uninstall script lives in a place the uninstaller deletes, you should probably copy the uninstall script somewhere else before running it:
cd
cp /Library/Receipts/MonoFramework-2.4_7.macos10.novell.universal.pkg/Contents/Resources/uninstallMono.sh .
sudo ./uninstallMono.sh
rm uninstallMono.sh
http://dragthor.wordpress.com/2007/07/24/uninstall-mono-on-mac-os-x/
Work for me, OSX, But I Use the uninstall script file (.sh) from the Mono Installer Package.
Mono doesn't contain a lot of fluff, so just running those commands will be fine. It's as simple as deleting all the data folders, and the binaries.
I just deleted the mono.frameworks folder. I got tired of answering "yes" billions of times...