Skip to content

Commit

Permalink
Update setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
lixfz committed Jul 14, 2022
1 parent 4547ca7 commit 51f5922
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-pytest-without-torch.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python pytest
name: Python pytest without torch

on:
push:
Expand Down
14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from setuptools import setup, Extension, find_packages

my_name = 'ylearn'
excludes_on_windows = ['torch', ]


def read_requirements(file_path='requirements.txt'):
Expand All @@ -20,8 +21,12 @@ def read_requirements(file_path='requirements.txt'):
lines = f.readlines()

lines = [x.strip('\n').strip(' ') for x in lines]
lines = list(filter(lambda x: len(x) > 0 and not x.startswith('#'), lines))
lines = filter(lambda x: len(x) > 0 and not x.startswith('#'), lines)

is_os_windows = sys.platform.find('win') == 0
if is_os_windows:
lines = filter(lambda x: x not in excludes_on_windows, lines)
lines = list(lines)
return lines


Expand Down Expand Up @@ -54,7 +59,6 @@ def execfile(fname, globs, locs=None):
version_ns = {}
execfile(P.join(HERE, my_name, '_version.py'), version_ns)
version = version_ns['__version__']
print("__version__=" + version)

np_include = numpy.get_include()
pyx_files = glob(f"{my_name}/**/*.pyx", recursive=True)
Expand All @@ -72,9 +76,13 @@ def execfile(fname, globs, locs=None):
raise FileNotFoundError(f'Not found c file for {pf}, '
f'run "python setup.py build_ext --inplace" to generate c files.')
pyx_modules = []

print('cmdline:', ' '.join(sys.argv))
print(f'{my_name}.__version__:' + version)
print('np_version:', numpy.__version__)
print('np_include:', np_include)
print('pyx extensions:', pyx_modules)
print('cpp extensions:', c_modules)
print('np_include', np_include)

c_modules = list(map(lambda f: Extension(f.replace(os.sep, '.'), [f'{f}.cpp'], include_dirs=[np_include]), c_modules))
if pyx_modules:
Expand Down
2 changes: 1 addition & 1 deletion ylearn/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.1'
__version__ = '0.1.1.0a2'

0 comments on commit 51f5922

Please sign in to comment.