FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
dbus-python/setup.py at master · posborne/dbus-python · GitHub
posborne
/
dbus-python
Public
Notifications
You must be signed in to change notification settings
Fork
9
Star
27
Code
Issues
7
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
dbus-python
/
setup.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
83 lines (73 loc) · 2.83 KB
Breadcrumbs
dbus-python
/
setup.py
Copy path
File metadata and controls
83 lines (73 loc) · 2.83 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# This file was created SPECIFICALLY to create a bdist that can be generated on an x64 Ubuntu and an x64 Centos
# machines.
#
# Centos notes:
# You must:
# - yum install autoconf libtool
# - yum install dbus-glib-devel dbus-devel (and it must be >= 1.6.0 for dbus-python >= 1.2.0 to work)
from
setuptools
import
setup
,
find_packages
from
distutils
.
extension
import
Extension
from
distutils
.
sysconfig
import
get_python_inc
from
distutils
.
util
import
spawn
from
distutils
.
command
.
build_ext
import
build_ext
as
_build_ext
from
distutils
import
log
from
glob
import
glob
import
os
import
sys
import
shutil
root_dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
def
run_autogen
():
global
root_dir
os
.
environ
[
'PYTHON'
]
=
sys
.
executable
spawn
([
os
.
path
.
join
(
root_dir
,
"autogen.sh"
)],
search_path
=
False
)
def
load_version
():
import
re
from
contextlib
import
closing
version
=
[
None
,
None
,
None
]
with
closing
(
open
(
os
.
path
.
join
(
root_dir
,
"configure.ac"
),
"r"
))
as
f
:
for
line
in
f
:
# lines:
# m4_define(dbus_python_major_version, 1)
# m4_define(dbus_python_minor_version, 2)
# m4_define(dbus_python_micro_version, 0)
line
=
line
.
strip
()
if
line
.
startswith
(
"m4_define(dbus_python_major_version,"
):
index
=
0
elif
line
.
startswith
(
"m4_define(dbus_python_minor_version,"
):
index
=
1
elif
line
.
startswith
(
"m4_define(dbus_python_micro_version,"
):
index
=
2
else
:
index
=
None
if
index
is
not
None
:
version
[
index
]
=
re
.
search
(
r"\s+(\d+)\)"
,
line
).
group
(
1
)
return
"."
.
join
(
version
)
class
build_ext
(
_build_ext
):
def
run
(
self
,
*
args
,
**
kwargs
):
# Make sure you have libtool >= 2.2.6 for Centos
# We ignore distutils build because the native build creates a valid shared libraries and python's default
# build doesn't (it then complains that _dbus_bindings.so is missing a symbol).
os
.
environ
[
'PYTHON'
]
=
sys
.
executable
run_autogen
()
spawn
([
"make"
,
"-C"
,
root_dir
],
search_path
=
True
)
for
name
in
[
ext
.
name
for
ext
in
self
.
extensions
]:
from_path
=
os
.
path
.
join
(
root_dir
,
name
,
".libs"
,
"{}.so"
.
format
(
name
))
to_path
=
self
.
get_ext_fullpath
(
name
)
log
.
info
(
"copying extension {} from {} to {}"
.
format
(
name
,
from_path
,
to_path
))
shutil
.
copyfile
(
from_path
,
to_path
)
if
sys
.
platform
.
startswith
(
'linux'
):
ext_modules
=
[
Extension
(
'_dbus_bindings'
, []),
Extension
(
'_dbus_glib_bindings'
, []),
]
else
:
ext_modules
=
[]
setup
(
name
=
'dbus-python'
,
version
=
load_version
(),
description
=
"DBus for Python"
,
packages
=
find_packages
(
exclude
=
[]),
zip_safe
=
False
,
ext_modules
=
ext_modules
,
cmdclass
=
{
'build_ext'
:
build_ext
}
)
Back
|
FazBrowse Home
|
New Git URL