Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
enstools-feature
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christoph.Fischer
enstools-feature
Commits
6e369cc8
Commit
6e369cc8
authored
3 years ago
by
Christoph.Fischer
Browse files
Options
Downloads
Patches
Plain Diff
fix in windows compilation
parent
b72c93c6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
enstools/feature/__init__.py
+10
-7
10 additions, 7 deletions
enstools/feature/__init__.py
with
10 additions
and
7 deletions
enstools/feature/__init__.py
+
10
−
7
View file @
6e369cc8
...
@@ -24,10 +24,10 @@ python_out = os.path.join(working_dir, '_proto_gen')
...
@@ -24,10 +24,10 @@ python_out = os.path.join(working_dir, '_proto_gen')
for
path
in
proto_files_g
:
for
path
in
proto_files_g
:
path_dir
=
os
.
path
.
dirname
(
path
)
path_dir
=
os
.
path
.
dirname
(
path
)
if
path
_dir
.
endswith
(
"
/
feature
/
identification
"
):
if
path
.
parts
[
-
3
:]
==
(
'
feature
'
,
'
identification
'
,
'
identification.proto
'
):
id_path_dir
=
path_dir
id_path_dir
=
path_dir
id_path
=
id_path_dir
+
"
/
identification.proto
"
id_path
=
os
.
path
.
join
(
id_path_dir
,
"
identification.proto
"
)
if
not
os
.
path
.
exists
(
id_path
):
if
not
os
.
path
.
exists
(
id_path
):
print
(
"
Could not find identification.proto main file.
"
)
print
(
"
Could not find identification.proto main file.
"
)
...
@@ -49,7 +49,7 @@ for path in proto_files_g:
...
@@ -49,7 +49,7 @@ for path in proto_files_g:
# merge path_dir and id_path_dir files (Properties by method and base file)
# merge path_dir and id_path_dir files (Properties by method and base file)
# wish there was an easier solution
# wish there was an easier solution
# create temporal file to merge them, compile, and delete at end
# create temporal file to merge them, compile, and delete at end
with
tempfile
.
NamedTemporaryFile
()
as
tmp
:
with
tempfile
.
NamedTemporaryFile
(
delete
=
False
)
as
tmp
:
files
=
[
path
,
id_path
]
files
=
[
path
,
id_path
]
for
fname
in
files
:
for
fname
in
files
:
...
@@ -60,14 +60,17 @@ for path in proto_files_g:
...
@@ -60,14 +60,17 @@ for path in proto_files_g:
protoc_command
=
[
protoc
,
'
-I=
'
+
os
.
path
.
dirname
(
tmp
.
name
),
'
--python_out=
'
+
python_out
,
tmp
.
name
]
protoc_command
=
[
protoc
,
'
-I=
'
+
os
.
path
.
dirname
(
tmp
.
name
),
'
--python_out=
'
+
python_out
,
tmp
.
name
]
print
(
"
Execute protoc for:
"
+
str
(
path
))
print
(
"
Execute protoc for:
"
+
str
(
path
))
if
subprocess
.
call
(
protoc_command
)
!=
0
:
# need to call protoc outside (for windows compatibility), otherwise protoc cant access file.
sys
.
exit
(
1
)
if
subprocess
.
call
(
protoc_command
)
!=
0
:
num_compied_files
+=
1
sys
.
exit
(
1
)
num_compied_files
+=
1
os
.
rename
(
os
.
rename
(
os
.
path
.
join
(
python_out
,
os
.
path
.
basename
(
tmp
.
name
))
+
"
_pb2.py
"
,
os
.
path
.
join
(
python_out
,
os
.
path
.
basename
(
tmp
.
name
))
+
"
_pb2.py
"
,
os
.
path
.
join
(
python_out
+
"
/
"
+
os
.
path
.
basename
(
path
)[:
-
6
])
+
"
_pb2.py
"
os
.
path
.
join
(
python_out
+
"
/
"
+
os
.
path
.
basename
(
path
)[:
-
6
])
+
"
_pb2.py
"
)
)
# delete temp now
os
.
remove
(
tmp
.
name
)
if
num_compied_files
:
if
num_compied_files
:
print
(
"
Compiled
"
+
str
(
num_compied_files
)
+
"
proto files.
"
)
print
(
"
Compiled
"
+
str
(
num_compied_files
)
+
"
proto files.
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment