Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2503db9

Browse files
committed
Improve setup script
Add main function inside __init__.py and also entry point in setup.py
1 parenta19fd94 commit2503db9

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

‎setup.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
extensions= [
55
Extension(
66
"screen",
7-
["screen.c"],
7+
["umonitor/screen.c"],
88
libraries= ["xcb-randr","xcb"]
99
),
1010
]
@@ -20,6 +20,12 @@
2020
description="Manage monitor configuration automatically.",
2121
url="https://github.com/rliou92/python-umonitor",
2222

23+
entry_points={
24+
'console_scripts': [
25+
'umonitor = umonitor:main',
26+
]
27+
},
28+
2329
zip_safe=False
2430

2531
)

‎umonitor/__init__.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
importlogging
2+
importos
3+
fromumonitor.umonitorimportUmonitor
4+
5+
defmain():
6+
# setup = current state of monitors, their resolutions, positions, etc
7+
# profile = loaded from configuration file
8+
9+
# PYTHONMALLOC=malloc valgrind --leak-check=full --show-leak-kinds=definite python umon2.py
10+
logging.basicConfig()
11+
12+
try:
13+
home=os.environ["HOME"]
14+
exceptKeyError:
15+
raiseException("Need home environment variable to locate configuration file.")
16+
config_folder=home+"/.config/umon"
17+
config_fn="/umon.conf"
18+
19+
logging.debug("Looking here for config file: %s"%config_folder+config_fn)
20+
21+
umon=Umonitor(config_folder,config_fn)
22+
umon.parse_args()
23+
umon.run()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp