Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8d8e851e
authored
Oct 01, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
circle: don't run watch.py on import
parent
595735da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
38 deletions
+36
-38
circle/watch.py
+36
-38
No files found.
circle/watch.py
View file @
8d8e851e
...
@@ -27,41 +27,39 @@ class LessUtils(object):
...
@@ -27,41 +27,39 @@ class LessUtils(object):
less_pathname
,
css_pathname
))
less_pathname
,
css_pathname
))
# for first run compile everything
if
__name__
==
"__main__"
:
print
(
"Initial LESS compiles"
)
# for first run compile everything
current_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
print
(
"Initial LESS compiles"
)
current_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
for
root
,
dirs
,
files
in
os
.
walk
(
"/home/cloud/circle/circle"
):
for
f
in
files
:
for
root
,
dirs
,
files
in
os
.
walk
(
"/home/cloud/circle/circle"
):
if
not
f
.
endswith
(
".less"
):
for
f
in
files
:
continue
if
not
f
.
endswith
(
".less"
):
continue
relpath
=
os
.
path
.
relpath
(
root
,
current_dir
)
if
relpath
.
startswith
((
"static_collected"
,
"bower_components"
)):
relpath
=
os
.
path
.
relpath
(
root
,
current_dir
)
continue
if
relpath
.
startswith
((
"static_collected"
,
"bower_components"
)):
continue
less_pathname
=
"
%
s/
%
s"
%
(
root
,
f
)
css_pathname
=
LessUtils
.
less_path_to_css_path
(
less_pathname
)
less_pathname
=
"
%
s/
%
s"
%
(
root
,
f
)
LessUtils
.
compile_less
(
less_pathname
,
css_pathname
)
css_pathname
=
LessUtils
.
less_path_to_css_path
(
less_pathname
)
LessUtils
.
compile_less
(
less_pathname
,
css_pathname
)
print
(
"
\n
%
s
\n
"
%
(
"="
*
30
))
print
(
"End of initial LESS compiles
\n
"
)
print
(
"
\n
%
s
\n
"
%
(
"="
*
30
))
print
(
"End of initial LESS compiles
\n
"
)
# after first run watch less files
# after first run watch less files
wm
=
pyinotify
.
WatchManager
()
wm
=
pyinotify
.
WatchManager
()
class
EventHandler
(
pyinotify
.
ProcessEvent
):
class
EventHandler
(
pyinotify
.
ProcessEvent
):
def
process_IN_MODIFY
(
self
,
event
):
def
process_IN_MODIFY
(
self
,
event
):
if
not
event
.
name
.
endswith
(
".less"
):
if
not
event
.
name
.
endswith
(
".less"
):
return
return
css_pathname
=
LessUtils
.
less_path_to_css_path
(
event
.
pathname
)
css_pathname
=
LessUtils
.
less_path_to_css_path
(
event
.
pathname
)
LessUtils
.
compile_less
(
event
.
pathname
,
css_pathname
)
LessUtils
.
compile_less
(
event
.
pathname
,
css_pathname
)
handler
=
EventHandler
()
notifier
=
pyinotify
.
Notifier
(
wm
,
handler
)
handler
=
EventHandler
()
wm
.
add_watch
(
current_dir
,
pyinotify
.
IN_MODIFY
,
rec
=
True
)
notifier
=
pyinotify
.
Notifier
(
wm
,
handler
)
notifier
.
loop
()
wm
.
add_watch
(
current_dir
,
pyinotify
.
IN_MODIFY
,
rec
=
True
)
notifier
.
loop
()
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