2016-08-01 16:33:28 +03:00
|
|
|
from distutils.ccompiler import new_compiler
|
2016-07-08 15:15:42 +03:00
|
|
|
from glob import glob
|
2016-08-01 16:33:28 +03:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import tempfile
|
2016-07-08 15:15:42 +03:00
|
|
|
|
2015-10-22 18:02:30 +03:00
|
|
|
try:
|
2016-04-08 21:48:31 +03:00
|
|
|
from setuptools import setup, Extensions
|
2015-10-22 18:02:30 +03:00
|
|
|
except ImportError:
|
2016-04-08 21:48:31 +03:00
|
|
|
from distutils.core import setup, Extension
|
2013-06-20 23:16:36 +04:00
|
|
|
|
2016-08-01 16:33:28 +03:00
|
|
|
def cc_has_feature(code=None, cflags=None, ldflags=None, cc=None):
|
|
|
|
"""test a C compiler feature, return True if supported, False otherwise"""
|
|
|
|
if code is None:
|
|
|
|
code = 'int main() { return 0; }'
|
|
|
|
if cflags is None:
|
|
|
|
cflags = []
|
|
|
|
if ldflags is None:
|
|
|
|
ldflags = []
|
|
|
|
if cc is None:
|
|
|
|
cc = new_compiler()
|
|
|
|
|
|
|
|
tmpdir = tempfile.mkdtemp(prefix='cc-feature-test')
|
|
|
|
try:
|
|
|
|
fname = os.path.join(tmpdir, 'a.c')
|
|
|
|
with open(fname, 'w') as f:
|
|
|
|
f.write(code)
|
|
|
|
objs = cc.compile([fname], output_dir=tmpdir, extra_postargs=cflags)
|
|
|
|
cc.link_executable(objs, os.path.join(tmpdir, 'a'),
|
|
|
|
extra_postargs=ldflags)
|
|
|
|
return True
|
|
|
|
except Exception:
|
|
|
|
return False
|
|
|
|
finally:
|
|
|
|
shutil.rmtree(tmpdir)
|
|
|
|
|
2016-07-22 22:44:59 +03:00
|
|
|
hgext3rd = [
|
|
|
|
p[:-3].replace('/', '.')
|
|
|
|
for p in glob('hgext3rd/*.py')
|
|
|
|
if p != 'hgext3rd/__init__.py'
|
|
|
|
]
|
|
|
|
|
2013-06-20 23:16:36 +04:00
|
|
|
setup(
|
2013-06-20 23:57:57 +04:00
|
|
|
name='fbhgext',
|
2016-03-29 04:44:56 +03:00
|
|
|
version='0.1.2',
|
2013-06-20 23:16:36 +04:00
|
|
|
author='Durham Goode',
|
|
|
|
maintainer='Durham Goode',
|
|
|
|
maintainer_email='durham@fb.com',
|
|
|
|
url='',
|
|
|
|
description='Facebook specific mercurial extensions',
|
|
|
|
long_description="",
|
|
|
|
keywords='fb hg mercurial',
|
|
|
|
license='',
|
2016-05-11 04:29:53 +03:00
|
|
|
packages=[
|
2016-05-26 22:34:38 +03:00
|
|
|
'fastmanifest',
|
2016-05-11 04:29:53 +03:00
|
|
|
'phabricator',
|
|
|
|
'sqldirstate',
|
|
|
|
],
|
2014-05-24 01:39:33 +04:00
|
|
|
py_modules=[
|
2016-07-22 22:44:59 +03:00
|
|
|
'statprof'
|
|
|
|
] + hgext3rd,
|
2016-04-08 21:48:31 +03:00
|
|
|
ext_modules = [
|
2016-05-26 21:34:56 +03:00
|
|
|
Extension('cfastmanifest',
|
|
|
|
sources=['cfastmanifest.c',
|
2016-05-26 21:33:07 +03:00
|
|
|
'cfastmanifest/bsearch.c',
|
|
|
|
'cfastmanifest/buffer.c',
|
|
|
|
'cfastmanifest/checksum.c',
|
|
|
|
'cfastmanifest/node.c',
|
|
|
|
'cfastmanifest/tree.c',
|
|
|
|
'cfastmanifest/tree_arena.c',
|
|
|
|
'cfastmanifest/tree_convert.c',
|
|
|
|
'cfastmanifest/tree_copy.c',
|
|
|
|
'cfastmanifest/tree_diff.c',
|
|
|
|
'cfastmanifest/tree_disk.c',
|
|
|
|
'cfastmanifest/tree_iterator.c',
|
|
|
|
'cfastmanifest/tree_path.c',
|
2016-04-19 01:40:42 +03:00
|
|
|
],
|
2016-05-26 21:33:07 +03:00
|
|
|
include_dirs=['cfastmanifest',
|
2016-04-19 01:40:42 +03:00
|
|
|
'/usr/local/include',
|
|
|
|
'/opt/local/include',
|
|
|
|
],
|
|
|
|
library_dirs=[
|
|
|
|
'/usr/local/lib',
|
|
|
|
'/opt/local/lib',
|
|
|
|
],
|
|
|
|
libraries=['crypto',
|
|
|
|
],
|
2016-06-10 08:45:05 +03:00
|
|
|
extra_compile_args=[
|
|
|
|
"-std=c99",
|
|
|
|
"-Wall",
|
|
|
|
"-Werror", "-Werror=strict-prototypes"],
|
2016-04-19 01:40:42 +03:00
|
|
|
)
|
2016-04-08 21:48:31 +03:00
|
|
|
],
|
2013-06-20 23:16:36 +04:00
|
|
|
)
|