Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2802f2b9
authored
Jan 30, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store: add doc
parent
c8a7d50d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
miscellaneous/store-server/TopList.py
+14
-2
No files found.
miscellaneous/store-server/TopList.py
View file @
2802f2b9
...
@@ -7,31 +7,43 @@ COUNT=5
...
@@ -7,31 +7,43 @@ COUNT=5
wm
=
WatchManager
()
wm
=
WatchManager
()
mask
=
IN_CREATE
|
IN_MODIFY
|
IN_DONT_FOLLOW
mask
=
IN_CREATE
|
IN_MODIFY
|
IN_DONT_FOLLOW
"""
Register given file to ~/../.top dir as a symbolic link.
"""
def
update_new
(
name
):
def
update_new
(
name
):
if
os
.
path
.
normpath
(
name
)
.
find
(
"/."
)
!=
-
1
:
if
os
.
path
.
normpath
(
name
)
.
find
(
"/."
)
!=
-
1
:
return
return
home
=
pwd
.
getpwuid
(
os
.
stat
(
name
)
.
st_uid
)
.
pw_dir
home
=
pwd
.
getpwuid
(
os
.
stat
(
name
)
.
st_uid
)
.
pw_dir
if
not
name
.
startswith
(
home
):
if
not
name
.
startswith
(
home
):
return
return
# outside home
top_dir
=
os
.
path
.
normpath
(
os
.
path
.
join
(
home
,
"../.top"
))
top_dir
=
os
.
path
.
normpath
(
os
.
path
.
join
(
home
,
"../.top"
))
try
:
try
:
os
.
mkdir
(
top_dir
)
os
.
mkdir
(
top_dir
)
except
OSError
:
except
OSError
:
for
f
in
os
.
listdir
(
top_dir
):
for
f
in
os
.
listdir
(
top_dir
):
if
os
.
readlink
(
os
.
path
.
join
(
top_dir
,
f
))
==
name
:
if
os
.
readlink
(
os
.
path
.
join
(
top_dir
,
f
))
==
name
:
return
return
# duplicate
for
i
in
range
(
1
,
COUNT
):
for
i
in
range
(
1
,
COUNT
):
try
:
try
:
os
.
rename
(
os
.
path
.
join
(
top_dir
,
str
(
i
+
1
)),
os
.
path
.
join
(
top_dir
,
str
(
i
)))
os
.
rename
(
os
.
path
.
join
(
top_dir
,
str
(
i
+
1
)),
os
.
path
.
join
(
top_dir
,
str
(
i
)))
except
OSError
as
e
:
except
OSError
as
e
:
pass
pass
os
.
symlink
(
name
,
os
.
path
.
join
(
top_dir
,
str
(
COUNT
)))
os
.
symlink
(
name
,
os
.
path
.
join
(
top_dir
,
str
(
COUNT
)))
"""
Process inotify event.
"""
class
Process
(
ProcessEvent
):
class
Process
(
ProcessEvent
):
def
process_default
(
self
,
event
):
def
process_default
(
self
,
event
):
if
event
.
name
:
if
event
.
name
:
update_new
(
os
.
path
.
join
(
event
.
path
,
event
.
name
))
update_new
(
os
.
path
.
join
(
event
.
path
,
event
.
name
))
"""
Watch continuously file modifications in /home.
"""
def
main
():
def
main
():
notifier
=
Notifier
(
wm
,
Process
())
notifier
=
Notifier
(
wm
,
Process
())
wdd
=
wm
.
add_watch
(
'/home'
,
mask
,
rec
=
True
)
wdd
=
wm
.
add_watch
(
'/home'
,
mask
,
rec
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment