##// END OF EJS Templates
setup.py: drop compatibility with Python 2.4 and 2.5 (BC)...
Pierre-Yves David -
r25009:e1fb276d default
parent child Browse files
Show More
@@ -1,650 +1,650 b''
1 1 #
2 2 # This is the mercurial setup script.
3 3 #
4 4 # 'python setup.py install', or
5 5 # 'python setup.py --help' for more options
6 6
7 7 import sys, platform
8 if getattr(sys, 'version_info', (0, 0, 0)) < (2, 4, 0, 'final'):
9 raise SystemExit("Mercurial requires Python 2.4 or later.")
8 if getattr(sys, 'version_info', (0, 0, 0)) < (2, 6, 0, 'final'):
9 raise SystemExit("Mercurial requires Python 2.6 or later.")
10 10
11 11 if sys.version_info[0] >= 3:
12 12 def b(s):
13 13 '''A helper function to emulate 2.6+ bytes literals using string
14 14 literals.'''
15 15 return s.encode('latin1')
16 16 printf = eval('print')
17 17 libdir_escape = 'unicode_escape'
18 18 else:
19 19 libdir_escape = 'string_escape'
20 20 def b(s):
21 21 '''A helper function to emulate 2.6+ bytes literals using string
22 22 literals.'''
23 23 return s
24 24 def printf(*args, **kwargs):
25 25 f = kwargs.get('file', sys.stdout)
26 26 end = kwargs.get('end', '\n')
27 27 f.write(b(' ').join(args) + end)
28 28
29 29 # Solaris Python packaging brain damage
30 30 try:
31 31 import hashlib
32 32 sha = hashlib.sha1()
33 33 except ImportError:
34 34 try:
35 35 import sha
36 36 sha.sha # silence unused import warning
37 37 except ImportError:
38 38 raise SystemExit(
39 39 "Couldn't import standard hashlib (incomplete Python install).")
40 40
41 41 try:
42 42 import zlib
43 43 zlib.compressobj # silence unused import warning
44 44 except ImportError:
45 45 raise SystemExit(
46 46 "Couldn't import standard zlib (incomplete Python install).")
47 47
48 48 # The base IronPython distribution (as of 2.7.1) doesn't support bz2
49 49 isironpython = False
50 50 try:
51 51 isironpython = (platform.python_implementation()
52 52 .lower().find("ironpython") != -1)
53 53 except AttributeError:
54 54 pass
55 55
56 56 if isironpython:
57 57 sys.stderr.write("warning: IronPython detected (no bz2 support)\n")
58 58 else:
59 59 try:
60 60 import bz2
61 61 bz2.BZ2Compressor # silence unused import warning
62 62 except ImportError:
63 63 raise SystemExit(
64 64 "Couldn't import standard bz2 (incomplete Python install).")
65 65
66 66 ispypy = "PyPy" in sys.version
67 67
68 68 import os, stat, subprocess, time
69 69 import re
70 70 import shutil
71 71 import tempfile
72 72 from distutils import log
73 73 from distutils.core import setup, Command, Extension
74 74 from distutils.dist import Distribution
75 75 from distutils.command.build import build
76 76 from distutils.command.build_ext import build_ext
77 77 from distutils.command.build_py import build_py
78 78 from distutils.command.install_lib import install_lib
79 79 from distutils.command.install_scripts import install_scripts
80 80 from distutils.spawn import spawn, find_executable
81 81 from distutils import file_util
82 82 from distutils.errors import CCompilerError, DistutilsExecError
83 83 from distutils.sysconfig import get_python_inc, get_config_var
84 84 from distutils.version import StrictVersion
85 85
86 86 convert2to3 = '--c2to3' in sys.argv
87 87 if convert2to3:
88 88 try:
89 89 from distutils.command.build_py import build_py_2to3 as build_py
90 90 from lib2to3.refactor import get_fixers_from_package as getfixers
91 91 except ImportError:
92 92 if sys.version_info[0] < 3:
93 93 raise SystemExit("--c2to3 is only compatible with python3.")
94 94 raise
95 95 sys.path.append('contrib')
96 96 elif sys.version_info[0] >= 3:
97 97 raise SystemExit("setup.py with python3 needs --c2to3 (experimental)")
98 98
99 99 scripts = ['hg']
100 100 if os.name == 'nt':
101 101 scripts.append('contrib/win32/hg.bat')
102 102
103 103 # simplified version of distutils.ccompiler.CCompiler.has_function
104 104 # that actually removes its temporary files.
105 105 def hasfunction(cc, funcname):
106 106 tmpdir = tempfile.mkdtemp(prefix='hg-install-')
107 107 devnull = oldstderr = None
108 108 try:
109 109 try:
110 110 fname = os.path.join(tmpdir, 'funcname.c')
111 111 f = open(fname, 'w')
112 112 f.write('int main(void) {\n')
113 113 f.write(' %s();\n' % funcname)
114 114 f.write('}\n')
115 115 f.close()
116 116 # Redirect stderr to /dev/null to hide any error messages
117 117 # from the compiler.
118 118 # This will have to be changed if we ever have to check
119 119 # for a function on Windows.
120 120 devnull = open('/dev/null', 'w')
121 121 oldstderr = os.dup(sys.stderr.fileno())
122 122 os.dup2(devnull.fileno(), sys.stderr.fileno())
123 123 objects = cc.compile([fname], output_dir=tmpdir)
124 124 cc.link_executable(objects, os.path.join(tmpdir, "a.out"))
125 125 except Exception:
126 126 return False
127 127 return True
128 128 finally:
129 129 if oldstderr is not None:
130 130 os.dup2(oldstderr, sys.stderr.fileno())
131 131 if devnull is not None:
132 132 devnull.close()
133 133 shutil.rmtree(tmpdir)
134 134
135 135 # py2exe needs to be installed to work
136 136 try:
137 137 import py2exe
138 138 py2exe.Distribution # silence unused import warning
139 139 py2exeloaded = True
140 140 # import py2exe's patched Distribution class
141 141 from distutils.core import Distribution
142 142 except ImportError:
143 143 py2exeloaded = False
144 144
145 145 def runcmd(cmd, env):
146 146 if (sys.platform == 'plan9'
147 147 and (sys.version_info[0] == 2 and sys.version_info[1] < 7)):
148 148 # subprocess kludge to work around issues in half-baked Python
149 149 # ports, notably bichued/python:
150 150 _, out, err = os.popen3(cmd)
151 151 return str(out), str(err)
152 152 else:
153 153 p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
154 154 stderr=subprocess.PIPE, env=env)
155 155 out, err = p.communicate()
156 156 return out, err
157 157
158 158 def runhg(cmd, env):
159 159 out, err = runcmd(cmd, env)
160 160 # If root is executing setup.py, but the repository is owned by
161 161 # another user (as in "sudo python setup.py install") we will get
162 162 # trust warnings since the .hg/hgrc file is untrusted. That is
163 163 # fine, we don't want to load it anyway. Python may warn about
164 164 # a missing __init__.py in mercurial/locale, we also ignore that.
165 165 err = [e for e in err.splitlines()
166 166 if not e.startswith(b('not trusting file')) \
167 167 and not e.startswith(b('warning: Not importing')) \
168 168 and not e.startswith(b('obsolete feature not enabled'))]
169 169 if err:
170 170 printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
171 171 printf(b('\n').join([b(' ') + e for e in err]), file=sys.stderr)
172 172 return ''
173 173 return out
174 174
175 175 version = ''
176 176
177 177 # Execute hg out of this directory with a custom environment which
178 178 # includes the pure Python modules in mercurial/pure. We also take
179 179 # care to not use any hgrc files and do no localization.
180 180 pypath = ['mercurial', os.path.join('mercurial', 'pure')]
181 181 env = {'PYTHONPATH': os.pathsep.join(pypath),
182 182 'HGRCPATH': '',
183 183 'LANGUAGE': 'C'}
184 184 if 'LD_LIBRARY_PATH' in os.environ:
185 185 env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
186 186 if 'SystemRoot' in os.environ:
187 187 # Copy SystemRoot into the custom environment for Python 2.6
188 188 # under Windows. Otherwise, the subprocess will fail with
189 189 # error 0xc0150004. See: http://bugs.python.org/issue3440
190 190 env['SystemRoot'] = os.environ['SystemRoot']
191 191
192 192 if os.path.isdir('.hg'):
193 193 cmd = [sys.executable, 'hg', 'log', '-r', '.', '--template', '{tags}\n']
194 194 numerictags = [t for t in runhg(cmd, env).split() if t[0].isdigit()]
195 195 hgid = runhg([sys.executable, 'hg', 'id', '-i'], env).strip()
196 196 if numerictags: # tag(s) found
197 197 version = numerictags[-1]
198 198 if hgid.endswith('+'): # propagate the dirty status to the tag
199 199 version += '+'
200 200 else: # no tag found
201 201 ltagcmd = [sys.executable, 'hg', 'parents', '--template',
202 202 '{latesttag}']
203 203 ltag = runhg(ltagcmd, env)
204 204 changessincecmd = [sys.executable, 'hg', 'log', '-T', 'x\n', '-r',
205 205 "only(.,'%s')" % ltag]
206 206 changessince = len(runhg(changessincecmd, env).splitlines())
207 207 version = '%s+%s-%s' % (ltag, changessince, hgid)
208 208 if version.endswith('+'):
209 209 version += time.strftime('%Y%m%d')
210 210 elif os.path.exists('.hg_archival.txt'):
211 211 kw = dict([[t.strip() for t in l.split(':', 1)]
212 212 for l in open('.hg_archival.txt')])
213 213 if 'tag' in kw:
214 214 version = kw['tag']
215 215 elif 'latesttag' in kw:
216 216 if 'changessincelatesttag' in kw:
217 217 version = '%(latesttag)s+%(changessincelatesttag)s-%(node).12s' % kw
218 218 else:
219 219 version = '%(latesttag)s+%(latesttagdistance)s-%(node).12s' % kw
220 220 else:
221 221 version = kw.get('node', '')[:12]
222 222
223 223 if version:
224 224 f = open("mercurial/__version__.py", "w")
225 225 f.write('# this file is autogenerated by setup.py\n')
226 226 f.write('version = "%s"\n' % version)
227 227 f.close()
228 228
229 229
230 230 try:
231 231 from mercurial import __version__
232 232 version = __version__.version
233 233 except ImportError:
234 234 version = 'unknown'
235 235
236 236 class hgbuild(build):
237 237 # Insert hgbuildmo first so that files in mercurial/locale/ are found
238 238 # when build_py is run next.
239 239 sub_commands = [('build_mo', None),
240 240
241 241 # We also need build_ext before build_py. Otherwise, when 2to3 is
242 242 # called (in build_py), it will not find osutil & friends,
243 243 # thinking that those modules are global and, consequently, making
244 244 # a mess, now that all module imports are global.
245 245
246 246 ('build_ext', build.has_ext_modules),
247 247 ] + build.sub_commands
248 248
249 249 class hgbuildmo(build):
250 250
251 251 description = "build translations (.mo files)"
252 252
253 253 def run(self):
254 254 if not find_executable('msgfmt'):
255 255 self.warn("could not find msgfmt executable, no translations "
256 256 "will be built")
257 257 return
258 258
259 259 podir = 'i18n'
260 260 if not os.path.isdir(podir):
261 261 self.warn("could not find %s/ directory" % podir)
262 262 return
263 263
264 264 join = os.path.join
265 265 for po in os.listdir(podir):
266 266 if not po.endswith('.po'):
267 267 continue
268 268 pofile = join(podir, po)
269 269 modir = join('locale', po[:-3], 'LC_MESSAGES')
270 270 mofile = join(modir, 'hg.mo')
271 271 mobuildfile = join('mercurial', mofile)
272 272 cmd = ['msgfmt', '-v', '-o', mobuildfile, pofile]
273 273 if sys.platform != 'sunos5':
274 274 # msgfmt on Solaris does not know about -c
275 275 cmd.append('-c')
276 276 self.mkpath(join('mercurial', modir))
277 277 self.make_file([pofile], mobuildfile, spawn, (cmd,))
278 278
279 279
280 280 class hgdist(Distribution):
281 281 pure = ispypy
282 282
283 283 global_options = Distribution.global_options + \
284 284 [('pure', None, "use pure (slow) Python "
285 285 "code instead of C extensions"),
286 286 ('c2to3', None, "(experimental!) convert "
287 287 "code with 2to3"),
288 288 ]
289 289
290 290 def has_ext_modules(self):
291 291 # self.ext_modules is emptied in hgbuildpy.finalize_options which is
292 292 # too late for some cases
293 293 return not self.pure and Distribution.has_ext_modules(self)
294 294
295 295 class hgbuildext(build_ext):
296 296
297 297 def build_extension(self, ext):
298 298 try:
299 299 build_ext.build_extension(self, ext)
300 300 except CCompilerError:
301 301 if not getattr(ext, 'optional', False):
302 302 raise
303 303 log.warn("Failed to build optional extension '%s' (skipping)",
304 304 ext.name)
305 305
306 306 class hgbuildpy(build_py):
307 307 if convert2to3:
308 308 fixer_names = sorted(set(getfixers("lib2to3.fixes") +
309 309 getfixers("hgfixes")))
310 310
311 311 def finalize_options(self):
312 312 build_py.finalize_options(self)
313 313
314 314 if self.distribution.pure:
315 315 if self.py_modules is None:
316 316 self.py_modules = []
317 317 for ext in self.distribution.ext_modules:
318 318 if ext.name.startswith("mercurial."):
319 319 self.py_modules.append("mercurial.pure.%s" % ext.name[10:])
320 320 self.distribution.ext_modules = []
321 321 else:
322 322 h = os.path.join(get_python_inc(), 'Python.h')
323 323 if not os.path.exists(h):
324 324 raise SystemExit('Python headers are required to build '
325 325 'Mercurial but weren\'t found in %s' % h)
326 326
327 327 def find_modules(self):
328 328 modules = build_py.find_modules(self)
329 329 for module in modules:
330 330 if module[0] == "mercurial.pure":
331 331 if module[1] != "__init__":
332 332 yield ("mercurial", module[1], module[2])
333 333 else:
334 334 yield module
335 335
336 336 class buildhgextindex(Command):
337 337 description = 'generate prebuilt index of hgext (for frozen package)'
338 338 user_options = []
339 339 _indexfilename = 'hgext/__index__.py'
340 340
341 341 def initialize_options(self):
342 342 pass
343 343
344 344 def finalize_options(self):
345 345 pass
346 346
347 347 def run(self):
348 348 if os.path.exists(self._indexfilename):
349 349 f = open(self._indexfilename, 'w')
350 350 f.write('# empty\n')
351 351 f.close()
352 352
353 353 # here no extension enabled, disabled() lists up everything
354 354 code = ('import pprint; from mercurial import extensions; '
355 355 'pprint.pprint(extensions.disabled())')
356 356 out, err = runcmd([sys.executable, '-c', code], env)
357 357 if err:
358 358 raise DistutilsExecError(err)
359 359
360 360 f = open(self._indexfilename, 'w')
361 361 f.write('# this file is autogenerated by setup.py\n')
362 362 f.write('docs = ')
363 363 f.write(out)
364 364 f.close()
365 365
366 366 class buildhgexe(build_ext):
367 367 description = 'compile hg.exe from mercurial/exewrapper.c'
368 368
369 369 def build_extensions(self):
370 370 if os.name != 'nt':
371 371 return
372 372 if isinstance(self.compiler, HackedMingw32CCompiler):
373 373 self.compiler.compiler_so = self.compiler.compiler # no -mdll
374 374 self.compiler.dll_libraries = [] # no -lmsrvc90
375 375 hv = sys.hexversion
376 376 pythonlib = 'python%d%d' % (hv >> 24, (hv >> 16) & 0xff)
377 377 f = open('mercurial/hgpythonlib.h', 'wb')
378 378 f.write('/* this file is autogenerated by setup.py */\n')
379 379 f.write('#define HGPYTHONLIB "%s"\n' % pythonlib)
380 380 f.close()
381 381 objects = self.compiler.compile(['mercurial/exewrapper.c'],
382 382 output_dir=self.build_temp)
383 383 dir = os.path.dirname(self.get_ext_fullpath('dummy'))
384 384 target = os.path.join(dir, 'hg')
385 385 self.compiler.link_executable(objects, target,
386 386 libraries=[],
387 387 output_dir=self.build_temp)
388 388
389 389 class hginstalllib(install_lib):
390 390 '''
391 391 This is a specialization of install_lib that replaces the copy_file used
392 392 there so that it supports setting the mode of files after copying them,
393 393 instead of just preserving the mode that the files originally had. If your
394 394 system has a umask of something like 027, preserving the permissions when
395 395 copying will lead to a broken install.
396 396
397 397 Note that just passing keep_permissions=False to copy_file would be
398 398 insufficient, as it might still be applying a umask.
399 399 '''
400 400
401 401 def run(self):
402 402 realcopyfile = file_util.copy_file
403 403 def copyfileandsetmode(*args, **kwargs):
404 404 src, dst = args[0], args[1]
405 405 dst, copied = realcopyfile(*args, **kwargs)
406 406 if copied:
407 407 st = os.stat(src)
408 408 # Persist executable bit (apply it to group and other if user
409 409 # has it)
410 410 if st[stat.ST_MODE] & stat.S_IXUSR:
411 411 setmode = int('0755', 8)
412 412 else:
413 413 setmode = int('0644', 8)
414 414 m = stat.S_IMODE(st[stat.ST_MODE])
415 415 m = (m & ~int('0777', 8)) | setmode
416 416 os.chmod(dst, m)
417 417 file_util.copy_file = copyfileandsetmode
418 418 try:
419 419 install_lib.run(self)
420 420 finally:
421 421 file_util.copy_file = realcopyfile
422 422
423 423 class hginstallscripts(install_scripts):
424 424 '''
425 425 This is a specialization of install_scripts that replaces the @LIBDIR@ with
426 426 the configured directory for modules. If possible, the path is made relative
427 427 to the directory for scripts.
428 428 '''
429 429
430 430 def initialize_options(self):
431 431 install_scripts.initialize_options(self)
432 432
433 433 self.install_lib = None
434 434
435 435 def finalize_options(self):
436 436 install_scripts.finalize_options(self)
437 437 self.set_undefined_options('install',
438 438 ('install_lib', 'install_lib'))
439 439
440 440 def run(self):
441 441 install_scripts.run(self)
442 442
443 443 if (os.path.splitdrive(self.install_dir)[0] !=
444 444 os.path.splitdrive(self.install_lib)[0]):
445 445 # can't make relative paths from one drive to another, so use an
446 446 # absolute path instead
447 447 libdir = self.install_lib
448 448 else:
449 449 common = os.path.commonprefix((self.install_dir, self.install_lib))
450 450 rest = self.install_dir[len(common):]
451 451 uplevel = len([n for n in os.path.split(rest) if n])
452 452
453 453 libdir = uplevel * ('..' + os.sep) + self.install_lib[len(common):]
454 454
455 455 for outfile in self.outfiles:
456 456 fp = open(outfile, 'rb')
457 457 data = fp.read()
458 458 fp.close()
459 459
460 460 # skip binary files
461 461 if b('\0') in data:
462 462 continue
463 463
464 464 data = data.replace(b('@LIBDIR@'), libdir.encode(libdir_escape))
465 465 fp = open(outfile, 'wb')
466 466 fp.write(data)
467 467 fp.close()
468 468
469 469 cmdclass = {'build': hgbuild,
470 470 'build_mo': hgbuildmo,
471 471 'build_ext': hgbuildext,
472 472 'build_py': hgbuildpy,
473 473 'build_hgextindex': buildhgextindex,
474 474 'install_lib': hginstalllib,
475 475 'install_scripts': hginstallscripts,
476 476 'build_hgexe': buildhgexe,
477 477 }
478 478
479 479 packages = ['mercurial', 'mercurial.hgweb', 'mercurial.httpclient',
480 480 'hgext', 'hgext.convert', 'hgext.highlight', 'hgext.zeroconf',
481 481 'hgext.largefiles']
482 482
483 483 pymodules = []
484 484
485 485 common_depends = ['mercurial/util.h']
486 486
487 487 extmodules = [
488 488 Extension('mercurial.base85', ['mercurial/base85.c'],
489 489 depends=common_depends),
490 490 Extension('mercurial.bdiff', ['mercurial/bdiff.c'],
491 491 depends=common_depends),
492 492 Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c'],
493 493 depends=common_depends),
494 494 Extension('mercurial.mpatch', ['mercurial/mpatch.c'],
495 495 depends=common_depends),
496 496 Extension('mercurial.parsers', ['mercurial/dirs.c',
497 497 'mercurial/manifest.c',
498 498 'mercurial/parsers.c',
499 499 'mercurial/pathencode.c'],
500 500 depends=common_depends),
501 501 ]
502 502
503 503 osutil_ldflags = []
504 504
505 505 if sys.platform == 'darwin':
506 506 osutil_ldflags += ['-framework', 'ApplicationServices']
507 507
508 508 # disable osutil.c under windows + python 2.4 (issue1364)
509 509 if sys.platform == 'win32' and sys.version_info < (2, 5, 0, 'final'):
510 510 pymodules.append('mercurial.pure.osutil')
511 511 else:
512 512 extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'],
513 513 extra_link_args=osutil_ldflags,
514 514 depends=common_depends))
515 515
516 516 try:
517 517 from distutils import cygwinccompiler
518 518
519 519 # the -mno-cygwin option has been deprecated for years
520 520 compiler = cygwinccompiler.Mingw32CCompiler
521 521
522 522 class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
523 523 def __init__(self, *args, **kwargs):
524 524 compiler.__init__(self, *args, **kwargs)
525 525 for i in 'compiler compiler_so linker_exe linker_so'.split():
526 526 try:
527 527 getattr(self, i).remove('-mno-cygwin')
528 528 except ValueError:
529 529 pass
530 530
531 531 cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler
532 532 except ImportError:
533 533 # the cygwinccompiler package is not available on some Python
534 534 # distributions like the ones from the optware project for Synology
535 535 # DiskStation boxes
536 536 class HackedMingw32CCompiler(object):
537 537 pass
538 538
539 539 packagedata = {'mercurial': ['locale/*/LC_MESSAGES/hg.mo',
540 540 'help/*.txt',
541 541 'default.d/*.rc',
542 542 'dummycert.pem']}
543 543
544 544 def ordinarypath(p):
545 545 return p and p[0] != '.' and p[-1] != '~'
546 546
547 547 for root in ('templates',):
548 548 for curdir, dirs, files in os.walk(os.path.join('mercurial', root)):
549 549 curdir = curdir.split(os.sep, 1)[1]
550 550 dirs[:] = filter(ordinarypath, dirs)
551 551 for f in filter(ordinarypath, files):
552 552 f = os.path.join(curdir, f)
553 553 packagedata['mercurial'].append(f)
554 554
555 555 datafiles = []
556 556 setupversion = version
557 557 extra = {}
558 558
559 559 if py2exeloaded:
560 560 extra['console'] = [
561 561 {'script':'hg',
562 562 'copyright':'Copyright (C) 2005-2015 Matt Mackall and others',
563 563 'product_version':version}]
564 564 # sub command of 'build' because 'py2exe' does not handle sub_commands
565 565 build.sub_commands.insert(0, ('build_hgextindex', None))
566 566
567 567 if os.name == 'nt':
568 568 # Windows binary file versions for exe/dll files must have the
569 569 # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
570 570 setupversion = version.split('+', 1)[0]
571 571
572 572 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
573 573 version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()
574 574 if version:
575 575 version = version[0]
576 576 xcode4 = (version.startswith('Xcode') and
577 577 StrictVersion(version.split()[1]) >= StrictVersion('4.0'))
578 578 xcode51 = re.match(r'^Xcode\s+5\.1', version) is not None
579 579 else:
580 580 # xcodebuild returns empty on OS X Lion with XCode 4.3 not
581 581 # installed, but instead with only command-line tools. Assume
582 582 # that only happens on >= Lion, thus no PPC support.
583 583 xcode4 = True
584 584 xcode51 = False
585 585
586 586 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
587 587 # distutils.sysconfig
588 588 if xcode4:
589 589 os.environ['ARCHFLAGS'] = ''
590 590
591 591 # XCode 5.1 changes clang such that it now fails to compile if the
592 592 # -mno-fused-madd flag is passed, but the version of Python shipped with
593 593 # OS X 10.9 Mavericks includes this flag. This causes problems in all
594 594 # C extension modules, and a bug has been filed upstream at
595 595 # http://bugs.python.org/issue21244. We also need to patch this here
596 596 # so Mercurial can continue to compile in the meantime.
597 597 if xcode51:
598 598 cflags = get_config_var('CFLAGS')
599 599 if cflags and re.search(r'-mno-fused-madd\b', cflags) is not None:
600 600 os.environ['CFLAGS'] = (
601 601 os.environ.get('CFLAGS', '') + ' -Qunused-arguments')
602 602
603 603 setup(name='mercurial',
604 604 version=setupversion,
605 605 author='Matt Mackall and many others',
606 606 author_email='mercurial@selenic.com',
607 607 url='http://mercurial.selenic.com/',
608 608 download_url='http://mercurial.selenic.com/release/',
609 609 description=('Fast scalable distributed SCM (revision control, version '
610 610 'control) system'),
611 611 long_description=('Mercurial is a distributed SCM tool written in Python.'
612 612 ' It is used by a number of large projects that require'
613 613 ' fast, reliable distributed revision control, such as '
614 614 'Mozilla.'),
615 615 license='GNU GPLv2 or any later version',
616 616 classifiers=[
617 617 'Development Status :: 6 - Mature',
618 618 'Environment :: Console',
619 619 'Intended Audience :: Developers',
620 620 'Intended Audience :: System Administrators',
621 621 'License :: OSI Approved :: GNU General Public License (GPL)',
622 622 'Natural Language :: Danish',
623 623 'Natural Language :: English',
624 624 'Natural Language :: German',
625 625 'Natural Language :: Italian',
626 626 'Natural Language :: Japanese',
627 627 'Natural Language :: Portuguese (Brazilian)',
628 628 'Operating System :: Microsoft :: Windows',
629 629 'Operating System :: OS Independent',
630 630 'Operating System :: POSIX',
631 631 'Programming Language :: C',
632 632 'Programming Language :: Python',
633 633 'Topic :: Software Development :: Version Control',
634 634 ],
635 635 scripts=scripts,
636 636 packages=packages,
637 637 py_modules=pymodules,
638 638 ext_modules=extmodules,
639 639 data_files=datafiles,
640 640 package_data=packagedata,
641 641 cmdclass=cmdclass,
642 642 distclass=hgdist,
643 643 options={'py2exe': {'packages': ['hgext', 'email']},
644 644 'bdist_mpkg': {'zipdist': False,
645 645 'license': 'COPYING',
646 646 'readme': 'contrib/macosx/Readme.html',
647 647 'welcome': 'contrib/macosx/Welcome.html',
648 648 },
649 649 },
650 650 **extra)
General Comments 0
You need to be logged in to leave comments. Login now