##// END OF EJS Templates
setup: move osutil_ldflags logic to before extmodules definition
Adrian Buehlmann -
r25073:c1a9e31b default
parent child Browse files
Show More
@@ -1,648 +1,648
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 8 if getattr(sys, 'version_info', (0, 0, 0)) < (2, 6, 0, 'final'):
9 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 osutil_ldflags = []
488
489 if sys.platform == 'darwin':
490 osutil_ldflags += ['-framework', 'ApplicationServices']
491
487 492 extmodules = [
488 493 Extension('mercurial.base85', ['mercurial/base85.c'],
489 494 depends=common_depends),
490 495 Extension('mercurial.bdiff', ['mercurial/bdiff.c'],
491 496 depends=common_depends),
492 497 Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c'],
493 498 depends=common_depends),
494 499 Extension('mercurial.mpatch', ['mercurial/mpatch.c'],
495 500 depends=common_depends),
496 501 Extension('mercurial.parsers', ['mercurial/dirs.c',
497 502 'mercurial/manifest.c',
498 503 'mercurial/parsers.c',
499 504 'mercurial/pathencode.c'],
500 505 depends=common_depends),
501 506 ]
502 507
503 osutil_ldflags = []
504
505 if sys.platform == 'darwin':
506 osutil_ldflags += ['-framework', 'ApplicationServices']
507
508 508 extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'],
509 509 extra_link_args=osutil_ldflags,
510 510 depends=common_depends))
511 511
512 512 try:
513 513 from distutils import cygwinccompiler
514 514
515 515 # the -mno-cygwin option has been deprecated for years
516 516 compiler = cygwinccompiler.Mingw32CCompiler
517 517
518 518 class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
519 519 def __init__(self, *args, **kwargs):
520 520 compiler.__init__(self, *args, **kwargs)
521 521 for i in 'compiler compiler_so linker_exe linker_so'.split():
522 522 try:
523 523 getattr(self, i).remove('-mno-cygwin')
524 524 except ValueError:
525 525 pass
526 526
527 527 cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler
528 528 except ImportError:
529 529 # the cygwinccompiler package is not available on some Python
530 530 # distributions like the ones from the optware project for Synology
531 531 # DiskStation boxes
532 532 class HackedMingw32CCompiler(object):
533 533 pass
534 534
535 535 packagedata = {'mercurial': ['locale/*/LC_MESSAGES/hg.mo',
536 536 'help/*.txt',
537 537 'default.d/*.rc',
538 538 'dummycert.pem']}
539 539
540 540 def ordinarypath(p):
541 541 return p and p[0] != '.' and p[-1] != '~'
542 542
543 543 for root in ('templates',):
544 544 for curdir, dirs, files in os.walk(os.path.join('mercurial', root)):
545 545 curdir = curdir.split(os.sep, 1)[1]
546 546 dirs[:] = filter(ordinarypath, dirs)
547 547 for f in filter(ordinarypath, files):
548 548 f = os.path.join(curdir, f)
549 549 packagedata['mercurial'].append(f)
550 550
551 551 datafiles = []
552 552 setupversion = version
553 553 extra = {}
554 554
555 555 if py2exeloaded:
556 556 extra['console'] = [
557 557 {'script':'hg',
558 558 'copyright':'Copyright (C) 2005-2015 Matt Mackall and others',
559 559 'product_version':version}]
560 560 # sub command of 'build' because 'py2exe' does not handle sub_commands
561 561 build.sub_commands.insert(0, ('build_hgextindex', None))
562 562
563 563 if os.name == 'nt':
564 564 # Windows binary file versions for exe/dll files must have the
565 565 # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
566 566 setupversion = version.split('+', 1)[0]
567 567
568 568 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
569 569 version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()
570 570 if version:
571 571 version = version[0]
572 572 if sys.version_info[0] == 3:
573 573 version = version.decode('utf-8')
574 574 xcode4 = (version.startswith('Xcode') and
575 575 StrictVersion(version.split()[1]) >= StrictVersion('4.0'))
576 576 xcode51 = re.match(r'^Xcode\s+5\.1', version) is not None
577 577 else:
578 578 # xcodebuild returns empty on OS X Lion with XCode 4.3 not
579 579 # installed, but instead with only command-line tools. Assume
580 580 # that only happens on >= Lion, thus no PPC support.
581 581 xcode4 = True
582 582 xcode51 = False
583 583
584 584 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
585 585 # distutils.sysconfig
586 586 if xcode4:
587 587 os.environ['ARCHFLAGS'] = ''
588 588
589 589 # XCode 5.1 changes clang such that it now fails to compile if the
590 590 # -mno-fused-madd flag is passed, but the version of Python shipped with
591 591 # OS X 10.9 Mavericks includes this flag. This causes problems in all
592 592 # C extension modules, and a bug has been filed upstream at
593 593 # http://bugs.python.org/issue21244. We also need to patch this here
594 594 # so Mercurial can continue to compile in the meantime.
595 595 if xcode51:
596 596 cflags = get_config_var('CFLAGS')
597 597 if cflags and re.search(r'-mno-fused-madd\b', cflags) is not None:
598 598 os.environ['CFLAGS'] = (
599 599 os.environ.get('CFLAGS', '') + ' -Qunused-arguments')
600 600
601 601 setup(name='mercurial',
602 602 version=setupversion,
603 603 author='Matt Mackall and many others',
604 604 author_email='mercurial@selenic.com',
605 605 url='http://mercurial.selenic.com/',
606 606 download_url='http://mercurial.selenic.com/release/',
607 607 description=('Fast scalable distributed SCM (revision control, version '
608 608 'control) system'),
609 609 long_description=('Mercurial is a distributed SCM tool written in Python.'
610 610 ' It is used by a number of large projects that require'
611 611 ' fast, reliable distributed revision control, such as '
612 612 'Mozilla.'),
613 613 license='GNU GPLv2 or any later version',
614 614 classifiers=[
615 615 'Development Status :: 6 - Mature',
616 616 'Environment :: Console',
617 617 'Intended Audience :: Developers',
618 618 'Intended Audience :: System Administrators',
619 619 'License :: OSI Approved :: GNU General Public License (GPL)',
620 620 'Natural Language :: Danish',
621 621 'Natural Language :: English',
622 622 'Natural Language :: German',
623 623 'Natural Language :: Italian',
624 624 'Natural Language :: Japanese',
625 625 'Natural Language :: Portuguese (Brazilian)',
626 626 'Operating System :: Microsoft :: Windows',
627 627 'Operating System :: OS Independent',
628 628 'Operating System :: POSIX',
629 629 'Programming Language :: C',
630 630 'Programming Language :: Python',
631 631 'Topic :: Software Development :: Version Control',
632 632 ],
633 633 scripts=scripts,
634 634 packages=packages,
635 635 py_modules=pymodules,
636 636 ext_modules=extmodules,
637 637 data_files=datafiles,
638 638 package_data=packagedata,
639 639 cmdclass=cmdclass,
640 640 distclass=hgdist,
641 641 options={'py2exe': {'packages': ['hgext', 'email']},
642 642 'bdist_mpkg': {'zipdist': False,
643 643 'license': 'COPYING',
644 644 'readme': 'contrib/macosx/Readme.html',
645 645 'welcome': 'contrib/macosx/Welcome.html',
646 646 },
647 647 },
648 648 **extra)
General Comments 0
You need to be logged in to leave comments. Login now