Show More
@@ -1,33 +1,34 b'' | |||
|
1 | 1 | syntax: glob |
|
2 | 2 | |
|
3 | 3 | *.elc |
|
4 | 4 | *.orig |
|
5 | 5 | *.rej |
|
6 | 6 | *~ |
|
7 | 7 | *.mergebackup |
|
8 | 8 | *.o |
|
9 | 9 | *.so |
|
10 | 10 | *.pyd |
|
11 | 11 | *.pyc |
|
12 | 12 | *.swp |
|
13 | 13 | *.prof |
|
14 | 14 | tests/.coverage* |
|
15 | 15 | tests/annotated |
|
16 | 16 | tests/*.err |
|
17 | 17 | build |
|
18 | 18 | contrib/hgsh/hgsh |
|
19 | 19 | dist |
|
20 | 20 | doc/*.[0-9] |
|
21 | 21 | doc/*.[0-9].gendoc.txt |
|
22 | 22 | doc/*.[0-9].{x,ht}ml |
|
23 | 23 | MANIFEST |
|
24 | 24 | patches |
|
25 | 25 | mercurial/__version__.py |
|
26 | 26 | Output/Mercurial-*.exe |
|
27 | 27 | .DS_Store |
|
28 | 28 | tags |
|
29 | 29 | cscope.* |
|
30 | i18n/hg.pot | |
|
30 | 31 | |
|
31 | 32 | syntax: regexp |
|
32 | 33 | ^\.pc/ |
|
33 | 34 | ^\.(pydev)?project |
@@ -1,79 +1,88 b'' | |||
|
1 | 1 | PREFIX=/usr/local |
|
2 | 2 | export PREFIX |
|
3 | 3 | PYTHON=python |
|
4 | 4 | |
|
5 | 5 | help: |
|
6 | 6 | @echo 'Commonly used make targets:' |
|
7 | 7 | @echo ' all - build program and documentation' |
|
8 | 8 | @echo ' install - install program and man pages to PREFIX ($(PREFIX))' |
|
9 | 9 | @echo ' install-home - install with setup.py install --home=HOME ($(HOME))' |
|
10 | 10 | @echo ' local - build for inplace usage' |
|
11 | 11 | @echo ' tests - run all tests in the automatic test suite' |
|
12 | 12 | @echo ' test-foo - run only specified tests (e.g. test-merge1)' |
|
13 | 13 | @echo ' dist - run all tests and create a source tarball in dist/' |
|
14 | 14 | @echo ' clean - remove files created by other targets' |
|
15 | 15 | @echo ' (except installed files or dist source tarball)' |
|
16 | @echo ' update-pot - update i18n/hg.pot' | |
|
16 | 17 | @echo |
|
17 | 18 | @echo 'Example for a system-wide installation under /usr/local:' |
|
18 | 19 | @echo ' make all && su -c "make install" && hg version' |
|
19 | 20 | @echo |
|
20 | 21 | @echo 'Example for a local installation (usable in this directory):' |
|
21 | 22 | @echo ' make local && ./hg version' |
|
22 | 23 | |
|
23 | 24 | all: build doc |
|
24 | 25 | |
|
25 | 26 | local: |
|
26 | 27 | $(PYTHON) setup.py build_ext -i |
|
27 | 28 | $(PYTHON) setup.py build_py -c -d . |
|
28 | 29 | $(PYTHON) hg version |
|
29 | 30 | |
|
30 | 31 | build: |
|
31 | 32 | $(PYTHON) setup.py build |
|
32 | 33 | |
|
33 | 34 | doc: |
|
34 | 35 | $(MAKE) -C doc |
|
35 | 36 | |
|
36 | 37 | clean: |
|
37 | 38 | -$(PYTHON) setup.py clean --all # ignore errors of this command |
|
38 | 39 | find . -name '*.py[cdo]' -exec rm -f '{}' ';' |
|
39 | 40 | rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err |
|
40 | 41 | $(MAKE) -C doc clean |
|
41 | 42 | |
|
42 | 43 | install: install-bin install-doc |
|
43 | 44 | |
|
44 | 45 | install-bin: build |
|
45 | 46 | $(PYTHON) setup.py install --prefix="$(PREFIX)" --force |
|
46 | 47 | |
|
47 | 48 | install-doc: doc |
|
48 | 49 | cd doc && $(MAKE) $(MFLAGS) install |
|
49 | 50 | |
|
50 | 51 | install-home: install-home-bin install-home-doc |
|
51 | 52 | |
|
52 | 53 | install-home-bin: build |
|
53 | 54 | $(PYTHON) setup.py install --home="$(HOME)" --force |
|
54 | 55 | |
|
55 | 56 | install-home-doc: doc |
|
56 | 57 | cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install |
|
57 | 58 | |
|
58 | 59 | MANIFEST-doc: |
|
59 | 60 | $(MAKE) -C doc MANIFEST |
|
60 | 61 | |
|
61 | 62 | MANIFEST: MANIFEST-doc |
|
62 | 63 | hg manifest > MANIFEST |
|
63 | 64 | echo mercurial/__version__.py >> MANIFEST |
|
64 | 65 | cat doc/MANIFEST >> MANIFEST |
|
65 | 66 | |
|
66 | 67 | dist: tests dist-notests |
|
67 | 68 | |
|
68 | 69 | dist-notests: doc MANIFEST |
|
69 | 70 | TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist |
|
70 | 71 | |
|
71 | 72 | tests: |
|
72 | 73 | cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) |
|
73 | 74 | |
|
74 | 75 | test-%: |
|
75 | 76 | cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@ |
|
76 | 77 | |
|
78 | update-pot: | |
|
79 | mkdir -p i18n | |
|
80 | pygettext -d doc -p i18n --docstrings \ | |
|
81 | mercurial/commands.py hgext/*.py hgext/*/__init__.py | |
|
82 | pygettext -d all -p i18n mercurial hgext doc | |
|
83 | msgcat i18n/doc.pot i18n/all.pot > i18n/hg.pot | |
|
84 | rm i18n/doc.pot i18n/all.pot | |
|
77 | 85 | |
|
78 | 86 | .PHONY: help all local build doc clean install install-bin install-doc \ |
|
79 | install-home install-home-bin install-home-doc dist dist-notests tests | |
|
87 | install-home install-home-bin install-home-doc dist dist-notests tests \ | |
|
88 | update-pot |
@@ -1,171 +1,175 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # |
|
3 | 3 | # This is the mercurial setup script. |
|
4 | 4 | # |
|
5 | 5 | # 'python setup.py install', or |
|
6 | 6 | # 'python setup.py --help' for more options |
|
7 | 7 | |
|
8 | 8 | import sys |
|
9 | 9 | if not hasattr(sys, 'version_info') or sys.version_info < (2, 3, 0, 'final'): |
|
10 | 10 | raise SystemExit("Mercurial requires python 2.3 or later.") |
|
11 | 11 | |
|
12 | 12 | # Solaris Python packaging brain damage |
|
13 | 13 | try: |
|
14 | 14 | import hashlib |
|
15 | 15 | sha = hashlib.sha1() |
|
16 | 16 | except: |
|
17 | 17 | try: |
|
18 | 18 | import sha |
|
19 | 19 | except: |
|
20 | 20 | raise SystemExit( |
|
21 | 21 | "Couldn't import standard hashlib (incomplete Python install).") |
|
22 | 22 | |
|
23 | 23 | try: |
|
24 | 24 | import zlib |
|
25 | 25 | except: |
|
26 | 26 | raise SystemExit( |
|
27 | 27 | "Couldn't import standard zlib (incomplete Python install).") |
|
28 | 28 | |
|
29 | 29 | import os, time |
|
30 | 30 | import shutil |
|
31 | 31 | import tempfile |
|
32 | 32 | from distutils.core import setup, Extension |
|
33 | 33 | from distutils.command.install_data import install_data |
|
34 | 34 | from distutils.ccompiler import new_compiler |
|
35 | 35 | |
|
36 | 36 | extra = {} |
|
37 | 37 | scripts = ['hg'] |
|
38 | 38 | if os.name == 'nt': |
|
39 | 39 | scripts.append('contrib/win32/hg.bat') |
|
40 | 40 | |
|
41 | 41 | # simplified version of distutils.ccompiler.CCompiler.has_function |
|
42 | 42 | # that actually removes its temporary files. |
|
43 | 43 | def has_function(cc, funcname): |
|
44 | 44 | tmpdir = tempfile.mkdtemp(prefix='hg-install-') |
|
45 | 45 | devnull = oldstderr = None |
|
46 | 46 | try: |
|
47 | 47 | try: |
|
48 | 48 | fname = os.path.join(tmpdir, 'funcname.c') |
|
49 | 49 | f = open(fname, 'w') |
|
50 | 50 | f.write('int main(void) {\n') |
|
51 | 51 | f.write(' %s();\n' % funcname) |
|
52 | 52 | f.write('}\n') |
|
53 | 53 | f.close() |
|
54 | 54 | # Redirect stderr to /dev/null to hide any error messages |
|
55 | 55 | # from the compiler. |
|
56 | 56 | # This will have to be changed if we ever have to check |
|
57 | 57 | # for a function on Windows. |
|
58 | 58 | devnull = open('/dev/null', 'w') |
|
59 | 59 | oldstderr = os.dup(sys.stderr.fileno()) |
|
60 | 60 | os.dup2(devnull.fileno(), sys.stderr.fileno()) |
|
61 | 61 | objects = cc.compile([fname]) |
|
62 | 62 | cc.link_executable(objects, os.path.join(tmpdir, "a.out")) |
|
63 | 63 | except: |
|
64 | 64 | return False |
|
65 | 65 | return True |
|
66 | 66 | finally: |
|
67 | 67 | if oldstderr is not None: |
|
68 | 68 | os.dup2(oldstderr, sys.stderr.fileno()) |
|
69 | 69 | if devnull is not None: |
|
70 | 70 | devnull.close() |
|
71 | 71 | shutil.rmtree(tmpdir) |
|
72 | 72 | |
|
73 | 73 | # py2exe needs to be installed to work |
|
74 | 74 | try: |
|
75 | 75 | import py2exe |
|
76 | 76 | |
|
77 | 77 | # Help py2exe to find win32com.shell |
|
78 | 78 | try: |
|
79 | 79 | import modulefinder |
|
80 | 80 | import win32com |
|
81 | 81 | for p in win32com.__path__[1:]: # Take the path to win32comext |
|
82 | 82 | modulefinder.AddPackagePath("win32com", p) |
|
83 | 83 | pn = "win32com.shell" |
|
84 | 84 | __import__(pn) |
|
85 | 85 | m = sys.modules[pn] |
|
86 | 86 | for p in m.__path__[1:]: |
|
87 | 87 | modulefinder.AddPackagePath(pn, p) |
|
88 | 88 | except ImportError: |
|
89 | 89 | pass |
|
90 | 90 | |
|
91 | 91 | extra['console'] = ['hg'] |
|
92 | 92 | |
|
93 | 93 | except ImportError: |
|
94 | 94 | pass |
|
95 | 95 | |
|
96 | 96 | try: |
|
97 | 97 | l = os.popen('hg id -it').read().split() |
|
98 | 98 | while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags |
|
99 | 99 | l.pop() |
|
100 | 100 | version = l and l[-1] or 'unknown' # latest tag or revision number |
|
101 | 101 | if version.endswith('+'): |
|
102 | 102 | version += time.strftime('%Y%m%d') |
|
103 | 103 | |
|
104 | 104 | except OSError: |
|
105 | 105 | version = "unknown" |
|
106 | 106 | |
|
107 | 107 | f = file("mercurial/__version__.py", "w") |
|
108 | 108 | f.write('# this file is autogenerated by setup.py\n') |
|
109 | 109 | f.write('version = "%s"\n' % version) |
|
110 | 110 | f.close() |
|
111 | 111 | |
|
112 | 112 | class install_package_data(install_data): |
|
113 | 113 | def finalize_options(self): |
|
114 | 114 | self.set_undefined_options('install', |
|
115 | 115 | ('install_lib', 'install_dir')) |
|
116 | 116 | install_data.finalize_options(self) |
|
117 | 117 | |
|
118 | 118 | cmdclass = {'install_data': install_package_data} |
|
119 | 119 | |
|
120 | 120 | ext_modules=[ |
|
121 | 121 | Extension('mercurial.base85', ['mercurial/base85.c']), |
|
122 | 122 | Extension('mercurial.bdiff', ['mercurial/bdiff.c']), |
|
123 | 123 | Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c']), |
|
124 | 124 | Extension('mercurial.mpatch', ['mercurial/mpatch.c']), |
|
125 | 125 | Extension('mercurial.parsers', ['mercurial/parsers.c']), |
|
126 | 126 | ] |
|
127 | 127 | |
|
128 | 128 | packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert', |
|
129 | 129 | 'hgext.highlight', 'hgext.zeroconf', ] |
|
130 | 130 | |
|
131 | 131 | try: |
|
132 | 132 | import msvcrt |
|
133 | 133 | ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'])) |
|
134 | 134 | except ImportError: |
|
135 | 135 | pass |
|
136 | 136 | |
|
137 | 137 | try: |
|
138 | 138 | import posix |
|
139 | 139 | ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'])) |
|
140 | 140 | |
|
141 | 141 | if sys.platform == 'linux2' and os.uname()[2] > '2.6': |
|
142 | 142 | # The inotify extension is only usable with Linux 2.6 kernels. |
|
143 | 143 | # You also need a reasonably recent C library. |
|
144 | 144 | cc = new_compiler() |
|
145 | 145 | if has_function(cc, 'inotify_add_watch'): |
|
146 | 146 | ext_modules.append(Extension('hgext.inotify.linux._inotify', |
|
147 | 147 | ['hgext/inotify/linux/_inotify.c'])) |
|
148 | 148 | packages.extend(['hgext.inotify', 'hgext.inotify.linux']) |
|
149 | 149 | except ImportError: |
|
150 | 150 | pass |
|
151 | 151 | |
|
152 | datafiles = [] | |
|
153 | for root in ('templates', 'i18n'): | |
|
154 | for dir, dirs, files in os.walk(root): | |
|
155 | datafiles.append((os.path.join('mercurial', dir), | |
|
156 | [os.path.join(dir, file_) for file_ in files])) | |
|
157 | ||
|
152 | 158 | setup(name='mercurial', |
|
153 | 159 | version=version, |
|
154 | 160 | author='Matt Mackall', |
|
155 | 161 | author_email='mpm@selenic.com', |
|
156 | 162 | url='http://selenic.com/mercurial', |
|
157 | 163 | description='Scalable distributed SCM', |
|
158 | 164 | license='GNU GPL', |
|
159 | 165 | scripts=scripts, |
|
160 | 166 | packages=packages, |
|
161 | 167 | ext_modules=ext_modules, |
|
162 | data_files=[(os.path.join('mercurial', root), | |
|
163 | [os.path.join(root, file_) for file_ in files]) | |
|
164 | for root, dirs, files in os.walk('templates')], | |
|
168 | data_files=datafiles, | |
|
165 | 169 | cmdclass=cmdclass, |
|
166 | 170 | options=dict(py2exe=dict(packages=['hgext', 'email']), |
|
167 | 171 | bdist_mpkg=dict(zipdist=True, |
|
168 | 172 | license='COPYING', |
|
169 | 173 | readme='contrib/macosx/Readme.html', |
|
170 | 174 | welcome='contrib/macosx/Welcome.html')), |
|
171 | 175 | **extra) |
General Comments 0
You need to be logged in to leave comments.
Login now