| Line | |
|---|
| 1 | #!/usr/bin/env python |
|---|
| 2 | # -*- coding: utf-8 -*- |
|---|
| 3 | """ |
|---|
| 4 | Configure |
|---|
| 5 | ~~~~~~~~~ |
|---|
| 6 | |
|---|
| 7 | Simple configure script that creates a makefile. |
|---|
| 8 | |
|---|
| 9 | :copyright: (c) 2010 by the Zine Team, see AUTHORS for more details. |
|---|
| 10 | :license: BSD, see LICENSE for more details. |
|---|
| 11 | """ |
|---|
| 12 | import os |
|---|
| 13 | import sys |
|---|
| 14 | from optparse import OptionParser |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | def main(): |
|---|
| 18 | global parser |
|---|
| 19 | parser = OptionParser(usage='%prog') |
|---|
| 20 | parser.add_option('--prefix', dest='prefix', default='/usr/local', |
|---|
| 21 | help='install architecture-independent files in PREFIX ' |
|---|
| 22 | '[/usr/local]') |
|---|
| 23 | parser.add_option('--python', dest='python', default=sys.executable, |
|---|
| 24 | help='the python version to use for the installation') |
|---|
| 25 | options, args = parser.parse_args() |
|---|
| 26 | |
|---|
| 27 | if args: |
|---|
| 28 | parser.error('too many arguments') |
|---|
| 29 | |
|---|
| 30 | f = file('Makefile.in') |
|---|
| 31 | try: |
|---|
| 32 | makefile_in = f.read() |
|---|
| 33 | finally: |
|---|
| 34 | f.close() |
|---|
| 35 | f = file('Makefile', 'w') |
|---|
| 36 | try: |
|---|
| 37 | f.write(makefile_in % { |
|---|
| 38 | 'PYTHON': options.python, |
|---|
| 39 | 'PREFIX': os.path.abspath(options.prefix) |
|---|
| 40 | }) |
|---|
| 41 | finally: |
|---|
| 42 | f.close() |
|---|
| 43 | print 'Generated Makefile' |
|---|
| 44 | print 'type "make install" to install Zine' |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | if __name__ == '__main__': |
|---|
| 48 | os.chdir(os.path.dirname(__file__) or '.') |
|---|
| 49 | main() |
|---|
Note: See
TracBrowser
for help on using the repository browser.