-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
129 lines (108 loc) · 3.61 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# -*- coding: utf-8 -*-
#
# Copyright © 2021 Malek Hadj-Ali
# All rights reserved.
#
# This file is part of mood.
#
# mood is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3
# as published by the Free Software Foundation.
#
# mood is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with mood. If not, see <http://www.gnu.org/licenses/>.
#
from setuptools import setup, find_packages, Extension
from distutils.version import LooseVersion
from ctypes.util import find_library
from ctypes import cdll
from codecs import open
from os.path import abspath
from sys import argv
# pkg
pkg_name = "mood.event"
pkg_version = "1.6.0"
pkg_desc = "Python libev interface"
PKG_VERSION = ("PKG_VERSION", "\"{0}\"".format(pkg_version))
err_msg = "Aborted: {0}-{1} requires {{0}} >= {{1}}".format(pkg_name, pkg_version)
def check_version(current_version, minimum_version, name):
if (
not current_version or
(LooseVersion(current_version) < LooseVersion(minimum_version))
):
raise SystemExit(err_msg.format(name, minimum_version))
# libev
libev_name = "ev"
libev_min_version = "4.33"
def libev_version():
libev_dll_name = find_library(libev_name)
if libev_dll_name:
libev_dll = cdll.LoadLibrary(libev_dll_name)
return "{0}.{1}".format(
libev_dll.ev_version_major(), libev_dll.ev_version_minor()
)
# setup
if "sdist" not in argv:
check_version(libev_version(), libev_min_version, "libev")
setup(
name=pkg_name,
version=pkg_version,
description=pkg_desc,
long_description=open(abspath("README.txt"), encoding="utf-8").read(),
long_description_content_type="text",
url="https://github.com/lekma/mood.event",
download_url="https://github.com/lekma/mood.event/releases",
project_urls={
"Documentation": "https://mood.readthedocs.io/projects/event/",
"Bug Tracker": "https://github.com/lekma/mood.event/issues"
},
author="Malek Hadj-Ali",
author_email="[email protected]",
license="GNU General Public License v3 (GPLv3)",
platforms=["POSIX"],
keywords="libev event",
setup_requires = ["setuptools>=24.2.0"],
python_requires="~=3.10",
packages=find_packages(),
namespace_packages=["mood"],
zip_safe=False,
ext_package="mood",
ext_modules=[
Extension(
"event",
[
"src/helpers/helpers.c",
"src/Loop.c",
"src/Watcher.c",
"src/Io.c",
"src/Timer.c",
"src/Periodic.c",
"src/Signal.c",
"src/Child.c",
"src/Idle.c",
"src/Prepare.c",
"src/Check.c",
"src/Embed.c",
"src/Fork.c",
"src/Async.c",
"src/event.c",
],
define_macros=[PKG_VERSION],
libraries=[libev_name]
)
],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: POSIX",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython"
]
)