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