diff --git a/setup.py b/setup.py index ad37b7c..622bbc6 100644 --- a/setup.py +++ b/setup.py @@ -269,6 +269,13 @@ def finalize_options(self): self.set_undefined_options('build', ('build_scripts', 'build_scripts')) def _clean_build(self): + # for clear old build cached (majorly for *.o) + # but, `pip install pyconcrete` will build wheel first, then do installation, should skip the case avoid + # to clear current building files + for cmd, ran in self.distribution.have_run.items(): + if cmd.startswith('build') and ran: + return + c = clean(self.distribution) c.all = True c.finalize_options() diff --git a/test/requirements.txt b/test/requirements.txt index 03bd1fc..3aa39c0 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -5,4 +5,5 @@ idna>=2.5,<3; python_version < "3" idna>=2.5,<4; python_version >= "3" urllib3>=1.21.1,<1.27 certifi>=2017.4.17 +wheel # ===== diff --git a/test/test_wheel.py b/test/test_wheel.py new file mode 100644 index 0000000..e36b2b3 --- /dev/null +++ b/test/test_wheel.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# +# Copyright 2015 Falldog Hsieh +# +# 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. + +import os +import subprocess +from test import base + +from src.config import PASSPHRASE_ENV + + +class TestWheel(base.TestPyConcreteBase): + def test_building_by_wheel(self): + env = os.environ.copy() + env[PASSPHRASE_ENV] = 'test' + sp = subprocess.run('pip wheel .', env=env, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + if sp.returncode != 0: + print(sp.stdout.decode('utf-8')) + raise Exception("pip create wheel fail...")