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