Skip to content

Commit 8fbbd6a

Browse files
Christian ToepferChristian Toepfer
authored andcommitted
update package format to wheel
1 parent 94285bc commit 8fbbd6a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

pyrobuf/compile.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import argparse
2+
import atexit
23
import glob
34
import os
45
import sys
56
from setuptools import setup
7+
from setuptools.command.install import install
8+
from setuptools.dist import Distribution
69
from datetime import datetime
710

811
from Cython.Build import cythonize
@@ -23,6 +26,14 @@
2326
VERSION = f'''{THE_TIME.year}.{THE_TIME.month}.{THE_TIME.day}'''\
2427
f'''{THE_TIME.hour*3600+THE_TIME.minute*60+THE_TIME.second}'''
2528

29+
def _post_install(*args):
30+
bdist_wheel_cmd = args[0].get_command_obj('bdist_wheel')
31+
tag = '-'.join(bdist_wheel_cmd.get_tag())
32+
os.system(f'python -m pip install --force-reinstall ./dist/{bdist_wheel_cmd.wheel_dist_name}-{tag}.whl')
33+
class new_install(install):
34+
def __init__(self, *args, **kwargs):
35+
super(new_install, self).__init__(*args, **kwargs)
36+
atexit.register(_post_install, *args)
2637
class BasePackagePatch_BuildExt(build_ext):
2738
""" Create __init__.py for base package, after build
2839
"""
@@ -91,10 +102,11 @@ def parse_cli_args(cls):
91102
clean=args.clean)
92103

93104
def compile(self):
94-
script_args = ['build', '--build-base={0}'.format(self.build)]
105+
script_args = ['build', '--build-base={0}'.format(self.build), 'bdist_wheel']
95106

107+
cmds = dict(build_ext=BasePackagePatch_BuildExt)
96108
if self.install:
97-
script_args.append('install')
109+
cmds['install'] = new_install
98110

99111
if self.force:
100112
script_args.append('--force')
@@ -108,7 +120,7 @@ def compile(self):
108120
version=VERSION,
109121
ext_modules=cythonize(self._pyx_files,
110122
include_path=self.include_path),
111-
cmdclass= dict(build_ext=BasePackagePatch_BuildExt),
123+
cmdclass=cmds,
112124
script_args=script_args)
113125

114126
def extend(self, dist):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import sys
1111

1212

13-
VERSION = "0.9.3.9"
13+
VERSION = "0.9.3.10"
1414
HERE = os.path.dirname(os.path.abspath(__file__))
1515
PYROBUF_DEFS_PXI = "pyrobuf_defs.pxi"
1616
PYROBUF_LIST_PXD = "pyrobuf_list.pxd"

0 commit comments

Comments
 (0)