setup.py 2.04 KB
Newer Older
1 2 3 4 5
#!/usr/bin/env python
#

import sys
import os
6
from setuptools import setup, Extension
7 8 9 10 11 12 13 14 15

def get_description():
    README = os.path.abspath(os.path.join(os.path.dirname(__file__), 'README'))
    f = open(README, 'r')
    try:
        return f.read()
    finally:
        f.close()

16
VERSION = "0.1.2"
17 18 19 20 21 22 23 24 25 26 27 28

if sys.platform.startswith("cygwin"):

    def get_winver():
        return '0x0503'
        maj, min = sys.getwindowsversion()[0:2]
        return '0x0%s' % ((maj * 100) + min)

    extensions = [Extension('netuse',
                            sources=['src/netuse.c'],
                            define_macros=[('_WIN32_WINNT', '0x0503'),
                                           ('USE_SYS_TYPES_FD_SET', 1)],
29 30
                            libraries=["kernel32", "advapi32", "shell32",
                                       "netapi32", "mpr"],
31 32 33 34 35 36 37 38 39 40
                            #extra_compile_args=["/Z7"],
                            #extra_link_args=["/DEBUG"]
                            )]
                                                        
else:
    sys.exit('platform %s is not supported' % sys.platform)


def main():
    setup_args = dict(
41
        name='netdrive',
42
        version=VERSION,
43
        description='A tool used to report the usage of net drive in the Windows',
44 45
        long_description=get_description(),
        keywords=['netdrive',],
46
        py_modules=['src/netreport'],
47 48 49 50
        author='Nexedi',
        author_email='jondy.zhao@nexedi.com',
        maintainer='Jondy Zhao',
        maintainer_email='jondy.zhao@nexedi.com',
51 52 53 54
        license='GPLv3',
        zip_safe=False,
        install_requires=[
            'lxml', 
55 56 57 58
            'slapos.core',
            'setuptools',
            'zc.buildout', # plays with buildout
            'zc.recipe.egg', # for scripts generation
59
            ],
60 61 62 63 64 65
      entry_points={
        'console_scripts': [
          'netdrive-reporter = netreport:main',
          ],
        }
    )
66 67 68 69 70 71
    if extensions is not None:
        setup_args["ext_modules"] = extensions
    setup(**setup_args)

if __name__ == '__main__':
    main()