Reputation: 9072
I have a python script "MAlice.py" (main) which depends upon several other scripts including yacc.py and lex.py and whatever they in turn import.
I don't have a lot of experience writing makefiles and I'm wondering how I can produce an executable called "compile" using this code, so that someone could call:
make
./compile "someTestFile.alice"
I'm working in Ubuntu.
Upvotes: 0
Views: 1662
Reputation: 92637
I think what you are looking for is a way to package your python project into a self-contained executable. It is not a compiling process but rather just a bundling into a portable environment. This will include your python interpreter.
You can look into pyinstaller for linux or windows. And py2app for osx (pyinstaller would work on osx as well to create just a single file)
If what you are after is the ability to provide a source package to someone and for them to be able to run a build command, and have an executable entry poiny called "compile", then what you want is simply a setuptools script. This will install all the declared dependencies and will create any named entry points you define.
http://packages.python.org/an_example_pypi_project/setuptools.html
Upvotes: 4
Reputation: 182038
Python scripts aren't compiled; they're interpreted. You can turn MAlice.py
itself into an executable script by adding this as the very first line:
#!/usr/bin/env python
And making the script executable:
chmod a+x MAlice.py
So then you can simply run it like this:
./MAlice.py "someTestFile.alice"
Upvotes: 0