refactor: Use pbr to get package version
1. use pbr to get package version 2. update the dependencies' version Change-Id: If221a54a2eecbca76c212838fddef272bfd48484
This commit is contained in:
parent
c12b6edcf0
commit
193f2ed6c7
@ -13,9 +13,9 @@ aiomysql<=0.1.1 # MIT
|
|||||||
aiosqlite<=0.17.0 # MIT
|
aiosqlite<=0.17.0 # MIT
|
||||||
loguru<=0.5.3 # MIT
|
loguru<=0.5.3 # MIT
|
||||||
PyYAML>=5.4.1,<=6.0 # MIT
|
PyYAML>=5.4.1,<=6.0 # MIT
|
||||||
immutables>=0.16,<=0.17 # Apache-2.0
|
immutables>=0.16 # Apache-2.0
|
||||||
alembic>=1.7.5,<=1.7.7 # MIT
|
alembic>=1.7.5,<=1.7.7 # MIT
|
||||||
httpx>=0.16.1,<=0.22.0 # BSD License (3 clause)
|
httpx>=0.16.1 # BSD License (3 clause)
|
||||||
SQLAlchemy>=1.3.24,<=1.4.36 # MIT
|
SQLAlchemy>=1.3.24,<=1.4.36 # MIT
|
||||||
PyMySQL>=0.9.3,<=1.0.2 # MIT
|
PyMySQL>=0.9.3,<=1.0.2 # MIT
|
||||||
dnspython>=2.1.0,<=2.2.1 # ISC
|
dnspython>=2.1.0,<=2.2.1 # ISC
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
# Copyright 2021 99cloud
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
__version__ = "0.1.0"
|
|
@ -20,7 +20,7 @@ import uuid
|
|||||||
from fastapi import HTTPException, status
|
from fastapi import HTTPException, status
|
||||||
from jose import jwt
|
from jose import jwt
|
||||||
|
|
||||||
from skyline_apiserver import __version__, schemas
|
from skyline_apiserver import schemas, version
|
||||||
from skyline_apiserver.client import utils
|
from skyline_apiserver.client import utils
|
||||||
from skyline_apiserver.client.utils import get_system_session
|
from skyline_apiserver.client.utils import get_system_session
|
||||||
from skyline_apiserver.config import CONF
|
from skyline_apiserver.config import CONF
|
||||||
@ -71,5 +71,5 @@ async def generate_profile(
|
|||||||
base_domains=CONF.openstack.base_domains,
|
base_domains=CONF.openstack.base_domains,
|
||||||
exp=exp or int(time.time()) + CONF.default.access_token_expire,
|
exp=exp or int(time.time()) + CONF.default.access_token_expire,
|
||||||
uuid=uuid_value or uuid.uuid4().hex,
|
uuid=uuid_value or uuid.uuid4().hex,
|
||||||
version=__version__,
|
version=version.version_string(),
|
||||||
)
|
)
|
||||||
|
@ -18,7 +18,7 @@ import time
|
|||||||
import pytest
|
import pytest
|
||||||
from httpx import AsyncClient
|
from httpx import AsyncClient
|
||||||
|
|
||||||
from skyline_apiserver import __version__, main
|
from skyline_apiserver import main, version
|
||||||
from skyline_apiserver.config import CONF
|
from skyline_apiserver.config import CONF
|
||||||
from skyline_apiserver.db import api as db_api, setup as db_setup
|
from skyline_apiserver.db import api as db_api, setup as db_setup
|
||||||
from skyline_apiserver.tests.utils import utils
|
from skyline_apiserver.tests.utils import utils
|
||||||
@ -60,7 +60,7 @@ async def test_get_profile_ok(client: AsyncClient, login_jwt: str) -> None:
|
|||||||
assert "projects" in result
|
assert "projects" in result
|
||||||
assert "base_roles" in result
|
assert "base_roles" in result
|
||||||
assert "base_domains" in result
|
assert "base_domains" in result
|
||||||
assert result["version"] == __version__
|
assert result["version"] == version.version_string()
|
||||||
assert len(CONF.openstack.base_domains) == len(result["base_domains"])
|
assert len(CONF.openstack.base_domains) == len(result["base_domains"])
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import uuid
|
|||||||
|
|
||||||
from httpx import AsyncClient
|
from httpx import AsyncClient
|
||||||
|
|
||||||
from skyline_apiserver import __version__, config, main, schemas
|
from skyline_apiserver import config, main, schemas, version
|
||||||
|
|
||||||
|
|
||||||
def get_session_profile() -> schemas.Profile:
|
def get_session_profile() -> schemas.Profile:
|
||||||
@ -62,7 +62,7 @@ def get_session_profile() -> schemas.Profile:
|
|||||||
"4c017648d2e34d1a8e732b98e3232af9": {"name": "alt_demo", "domain_id": "default"},
|
"4c017648d2e34d1a8e732b98e3232af9": {"name": "alt_demo", "domain_id": "default"},
|
||||||
"e88226c062094881b7a1f01517b945b4": {"name": "admin", "domain_id": "default"},
|
"e88226c062094881b7a1f01517b945b4": {"name": "admin", "domain_id": "default"},
|
||||||
},
|
},
|
||||||
version=__version__,
|
version=version.version_string(),
|
||||||
)
|
)
|
||||||
return profile
|
return profile
|
||||||
|
|
||||||
|
23
skyline_apiserver/version.py
Normal file
23
skyline_apiserver/version.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2022 99cloud
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from pbr import version as pbr_version
|
||||||
|
|
||||||
|
SKYLINE_APISERVER_VENDOR = "OpenStack Foundation"
|
||||||
|
SKYLINE_APISERVER_PRODUCT = "OpenStack Skyline APIServer"
|
||||||
|
SKYLINE_APISERVER_PACKAGE = None # OS distro package version suffix
|
||||||
|
|
||||||
|
loaded = False
|
||||||
|
version_info = pbr_version.VersionInfo("skyline-apiserver")
|
||||||
|
version_string = version_info.version_string
|
@ -8,7 +8,7 @@ Sphinx<=4.5.0 # BSD
|
|||||||
isort<=5.9.3 # MIT
|
isort<=5.9.3 # MIT
|
||||||
black<=22.3.0 # MIT
|
black<=22.3.0 # MIT
|
||||||
flake8<=3.9.2 # MIT
|
flake8<=3.9.2 # MIT
|
||||||
mypy>=0.910,<=0.950 # MIT
|
mypy>=0.910 # MIT
|
||||||
pytest>=6.2.5,<=7.1.2 # MIT
|
pytest>=6.2.5,<=7.1.2 # MIT
|
||||||
pytest-xdist>=2.4.0,<=2.5.0 # MIT
|
pytest-xdist>=2.4.0,<=2.5.0 # MIT
|
||||||
pytest-asyncio<=0.15.1 # Apache-2.0
|
pytest-asyncio<=0.15.1 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user