import platform

from setuptools import Extension, find_packages, setup

arpreq = Extension('arpreq', sources=['src/arpreq.c'],
                   extra_compile_args=['-std=c99'])

python_major_version = platform.python_version_tuple()[0]


tests_require = [
        'pytest',
        'netaddr'
]
if python_major_version == '2':
    tests_require.append('ipaddr')


setup(name='arpreq',
      author='Sebastian Schrader',
      author_email='sebastian.schrader@ossmail.de',
      url='https://github.com/sebschrader/python-arpreq',
      version='0.1.0',
      description="Query the Kernel ARP cache for the MAC address "
                  "corresponding to IP address",
      packages=find_packages(exclude=["*.tests"]),
      setup_requires=[
          'pytest-runner'
      ],
      tests_require=tests_require,
      ext_modules=[arpreq],
      classifiers=[
          'Development Status :: 5 - Production/Stable',
          'License :: OSI Approved :: MIT License',
          'Intended Audience :: System Administrators',
          'Operating System :: POSIX :: Linux',
          'Programming Language :: Python :: 2',
          'Programming Language :: Python :: 2.6',
          'Programming Language :: Python :: 2.7',
          'Programming Language :: Python :: 3',
          'Programming Language :: Python :: 3.4',
          'Programming Language :: Python :: 3.5',
          'Programming Language :: Python :: Implementation :: CPython',
          'Topic :: System :: Networking',
      ],
      )

@@ -66,16 +66,407 @@
  setup%0A%0A
+%0A# PyPy does include glibc standard headers, but does not define any of the%0A# feature_test_macros(7)%0A# CPython on the other hand complains, if you define any of these macros%0Aif platform.python_implementation() == 'PyPy':%0A    define_macros = %5B%0A            ('_XOPEN_SOURCE', '700'),%0A            ('_DEFAULT_SOURCE', '1'),%0A            ('_BSD_SOURCE', '1'),%0A    %5D%0Aelse:%0A    define_macros = None%0A%0A
 arpreq =
@@ -562,16 +562,64 @@
 td=c99'%5D
+,%0A                   define_macros=define_macros
 )%0A%0Apytho

Build with _POSIX_SOURCE and _DEFAULT_SOURCE