Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
SOLOv2-pytorch
Commits
4c376e58
Commit
4c376e58
authored
Sep 30, 2018
by
Kai Chen
Browse files
add git hash to version info
parent
300f7157
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
27 deletions
+94
-27
mmdet/__init__.py
mmdet/__init__.py
+1
-1
mmdet/version.py
mmdet/version.py
+0
-1
setup.py
setup.py
+93
-25
No files found.
mmdet/__init__.py
View file @
4c376e58
from
.version
import
__version__
from
.version
import
__version__
,
short_version
mmdet/version.py
deleted
100644 → 0
View file @
300f7157
__version__
=
'0.5.0'
setup.py
View file @
4c376e58
import
os
import
subprocess
import
time
from
setuptools
import
find_packages
,
setup
from
setuptools
import
find_packages
,
setup
...
@@ -7,34 +10,99 @@ def readme():
...
@@ -7,34 +10,99 @@ def readme():
return
content
return
content
MAJOR
=
0
MINOR
=
5
PATCH
=
0
SUFFIX
=
''
SHORT_VERSION
=
'{}.{}.{}{}'
.
format
(
MAJOR
,
MINOR
,
PATCH
,
SUFFIX
)
version_file
=
'mmdet/version.py'
def
get_git_hash
():
def
_minimal_ext_cmd
(
cmd
):
# construct minimal environment
env
=
{}
for
k
in
[
'SYSTEMROOT'
,
'PATH'
,
'HOME'
]:
v
=
os
.
environ
.
get
(
k
)
if
v
is
not
None
:
env
[
k
]
=
v
# LANGUAGE is used on win32
env
[
'LANGUAGE'
]
=
'C'
env
[
'LANG'
]
=
'C'
env
[
'LC_ALL'
]
=
'C'
out
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
env
=
env
).
communicate
()[
0
]
return
out
try
:
out
=
_minimal_ext_cmd
([
'git'
,
'rev-parse'
,
'HEAD'
])
sha
=
out
.
strip
().
decode
(
'ascii'
)
except
OSError
:
sha
=
'unknown'
return
sha
def
get_hash
():
if
os
.
path
.
exists
(
'.git'
):
sha
=
get_git_hash
()[:
7
]
elif
os
.
path
.
exists
(
version_file
):
try
:
from
mmdet.version
import
__version__
sha
=
__version__
.
split
(
'+'
)[
-
1
]
except
ImportError
:
raise
ImportError
(
'Unable to get git version'
)
else
:
sha
=
'unknown'
return
sha
def
write_version_py
():
content
=
"""# GENERATED VERSION FILE
# TIME: {}
__version__ = '{}'
short_version = '{}'
"""
sha
=
get_hash
()
VERSION
=
SHORT_VERSION
+
'+'
+
sha
with
open
(
version_file
,
'w'
)
as
f
:
f
.
write
(
content
.
format
(
time
.
asctime
(),
VERSION
,
SHORT_VERSION
))
def
get_version
():
def
get_version
():
version_file
=
'mmdet/version.py'
with
open
(
version_file
,
'r'
)
as
f
:
with
open
(
version_file
,
'r'
)
as
f
:
exec
(
compile
(
f
.
read
(),
version_file
,
'exec'
))
exec
(
compile
(
f
.
read
(),
version_file
,
'exec'
))
return
locals
()[
'__version__'
]
return
locals
()[
'__version__'
]
setup
(
if
__name__
==
'__main__'
:
name
=
'mmdet'
,
write_version_py
()
version
=
get_version
(),
setup
(
description
=
'Open MMLab Detection Toolbox'
,
name
=
'mmdet'
,
long_description
=
readme
(),
version
=
get_version
(),
keywords
=
'computer vision, object detection'
,
description
=
'Open MMLab Detection Toolbox'
,
packages
=
find_packages
(),
long_description
=
readme
(),
classifiers
=
[
keywords
=
'computer vision, object detection'
,
'Development Status :: 4 - Beta'
,
packages
=
find_packages
(),
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)'
,
classifiers
=
[
'Operating System :: OS Independent'
,
'Development Status :: 4 - Beta'
,
'Programming Language :: Python :: 2'
,
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)'
,
'Programming Language :: Python :: 2.7'
,
'Operating System :: OS Independent'
,
'Programming Language :: Python :: 3'
,
'Programming Language :: Python :: 2'
,
'Programming Language :: Python :: 3.4'
,
'Programming Language :: Python :: 2.7'
,
'Programming Language :: Python :: 3.5'
,
'Programming Language :: Python :: 3'
,
'Programming Language :: Python :: 3.6'
,
'Programming Language :: Python :: 3.4'
,
'Topic :: Utilities'
,
'Programming Language :: Python :: 3.5'
,
],
'Programming Language :: Python :: 3.6'
,
license
=
'GPLv3'
,
'Topic :: Utilities'
,
setup_requires
=
[
'pytest-runner'
],
],
tests_require
=
[
'pytest'
],
license
=
'GPLv3'
,
install_requires
=
[
'numpy'
,
'matplotlib'
,
'six'
,
'terminaltables'
],
setup_requires
=
[
'pytest-runner'
],
zip_safe
=
False
)
tests_require
=
[
'pytest'
],
install_requires
=
[
'numpy'
,
'matplotlib'
,
'six'
,
'terminaltables'
],
zip_safe
=
False
)
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