Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
settingsd
Commits
703b60e2
Commit
703b60e2
authored
Oct 13, 2010
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring, using re.sub() instead str.replace()
parent
52a876f9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
fmod_services.py
functions/fmod_services.py
+3
-4
No files found.
functions/fmod_services.py
View file @
703b60e2
...
@@ -14,7 +14,6 @@ from settingsd import logger
...
@@ -14,7 +14,6 @@ from settingsd import logger
##### Private constants #####
##### Private constants #####
SERVICE_NAME
=
"services"
SERVICE_NAME
=
"services"
SHARED_SERVICE_NAME
=
"Services"
RUNLEVELS
=
"0123456"
RUNLEVELS
=
"0123456"
...
@@ -157,15 +156,15 @@ class Service(service.Service) :
...
@@ -157,15 +156,15 @@ class Service(service.Service) :
raise
SubprocessFailure
(
"Error while execute
\"
%
s
\"\n
Stdout:
%
s
\n
Stderr:
%
s"
%
(
proc_args
,
proc_stdout
,
proc_stderr
))
raise
SubprocessFailure
(
"Error while execute
\"
%
s
\"\n
Stdout:
%
s
\n
Stderr:
%
s"
%
(
proc_args
,
proc_stdout
,
proc_stderr
))
system_service_count
=
0
system_service_count
=
0
shared
.
Functions
.
addShared
(
S
HARED_S
ERVICE_NAME
)
shared
.
Functions
.
addShared
(
SERVICE_NAME
)
for
system_service_record
in
proc_stdout
.
split
(
"
\n
"
)
:
for
system_service_record
in
proc_stdout
.
split
(
"
\n
"
)
:
system_service_record_list
=
re
.
split
(
r"\s+"
,
system_service_record
)
system_service_record_list
=
re
.
split
(
r"\s+"
,
system_service_record
)
if
len
(
system_service_record_list
)
!=
len
(
RUNLEVELS
)
+
1
:
if
len
(
system_service_record_list
)
!=
len
(
RUNLEVELS
)
+
1
:
continue
continue
system_service_name
=
system_service_record_list
[
0
]
system_service_name
=
system_service_record_list
[
0
]
dbus_system_service_name
=
system_service_name
.
replace
(
"-"
,
"_"
)
.
replace
(
"."
,
"_"
)
dbus_system_service_name
=
re
.
sub
(
r"-|\."
,
"_"
,
system_service_name
)
shared
.
Functions
.
shared
(
S
HARED_S
ERVICE_NAME
)
.
addSharedObject
(
dbus_system_service_name
,
SystemService
(
system_service_name
,
shared
.
Functions
.
shared
(
SERVICE_NAME
)
.
addSharedObject
(
dbus_system_service_name
,
SystemService
(
system_service_name
,
dbus_tools
.
joinPath
(
SERVICE_NAME
,
dbus_system_service_name
),
self
))
dbus_tools
.
joinPath
(
SERVICE_NAME
,
dbus_system_service_name
),
self
))
system_service_count
+=
1
system_service_count
+=
1
...
...
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