Skip to content

Commit

Permalink
Check style of setup.py and sample project
Browse files Browse the repository at this point in the history
  • Loading branch information
hombit committed Oct 31, 2018
1 parent f0b89f3 commit 2f19da7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
24 changes: 20 additions & 4 deletions bin/sci_py_test_style
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,28 @@ def check_style(fpath):
return style.check_files([fpath])


if __name__ == '__main__':
def package_files(package_dir):
def path(ext):
return os.path.join(package_dir, '**/*'+ext)

fpaths = list(chain.from_iterable(
(glob.iglob(path(ext), recursive=True) for ext in EXTS)
))
setup_py = os.path.join(package_dir, '../setup.py')
fpaths.append(setup_py)
return fpaths


def main():
dir_name = argv[1]
script_dir = os.path.join(dir_name, 'bin')
package_dir = os.path.join(dir_name, 'scientific_python')
book_dir = os.path.join(dir_name, 'misc/book')
sample_proj_dir = os.path.join(dir_name, 'misc/sample_project/ser')

fpaths = [os.path.join(script_dir, script) for script in SCRIPTS]
fpaths += list(chain.from_iterable(
(glob.iglob(os.path.join(package_dir, '**/*'+ext)) for ext in EXTS)
))
fpaths += package_files(package_dir)
fpaths += package_files(sample_proj_dir)
fpaths += glob.glob(os.path.join(book_dir, '*.py'))
print(fpaths)

Expand All @@ -56,3 +68,7 @@ if __name__ == '__main__':
raise RuntimeError(msg)
else:
print("Style check hasn't found any errors")


if __name__ == '__main__':
main()
19 changes: 13 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import glob

packagename='scientific_python'
packagename = 'scientific_python'

# Cython related
try:
Expand All @@ -29,20 +29,27 @@
here = os.path.abspath(os.path.dirname(__file__))

with open(os.path.join(here, 'requirements.txt')) as f:
install_requires=f.read().splitlines()
install_requires = f.read().splitlines()

description = """
Materials for Scientific Python course for astronomy students of
Moscow University
""".replace('\n', ' ')

setup(
name=packagename,
version='0.2.0',
version='0.2.1',
url='http://homb.it/sci_py/',
license='MIT',
author='Konstantin Malanchev',
author_email='malanchev@physics.msu.ru',
description='Package with materials for Scientific Python course for astronomers in Moscow University',
description=description,
packages=find_packages(),
# If you have only one Python module use `py_modules` instead of `packages`:
# If you have only one Python file use `py_modules` instead of `packages`:
# py_modules=['mymodule'],
scripts=['bin/sci_py_example', 'bin/sci_py_import_all', 'bin/sci_py_test_style'],
scripts=['bin/sci_py_example',
'bin/sci_py_import_all',
'bin/sci_py_test_style'],
ext_modules=ext_modules, # for Cython
data_files=[
('doc', ['doc/course_abstract.docx']),
Expand Down

0 comments on commit 2f19da7

Please sign in to comment.