File size: 1,069 Bytes
fc0f7bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import os
import shutil
import subprocess
import time


def build_package():
    print('removing build directory')
    shutil.rmtree("build", True)
    print('removing fairlearn.egg-info')
    shutil.rmtree("fairlearn.egg-info", True)
    print('removing dist directory')
    shutil.rmtree("dist", True)

    print('running python setup.py bdist_wheel')
    subprocess.Popen(["python", "setup.py", "bdist_wheel"], cwd=os.getcwd(), shell=True).wait()
    for root, dirs, files in os.walk("dist"):
        for file in files:
            if file.endswith(".whl"):
                print("Found wheel {}".format(file))
                # change wheel name to be unique for every run
                src = os.path.join("dist", file)
                dst = os.path.join("dist", "fairlearn-v{}-py3-none-any.whl"
                                   .format(time.time()))
                shutil.copy(src, dst)
                return dst

    raise Exception("Couldn't find wheel file.")