mirror of https://github.com/tqdm/tqdm.git
find_packages() for submodules
fixes 97a9393274 (commitcomment-29855558)
This commit is contained in:
parent
625a7dcd8e
commit
1cf3393255
20
setup.py
20
setup.py
|
@ -3,9 +3,15 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
try:
|
try:
|
||||||
from setuptools import setup
|
from setuptools import setup, find_packages
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
|
def find_packages(where='.'):
|
||||||
|
# os.walk -> list[(dirname, list[subdirs], list[files])]
|
||||||
|
return [folder.replace("/", ".").lstrip(".")
|
||||||
|
for (folder, _, fils) in os.walk(where)
|
||||||
|
if "__init__.py" in fils]
|
||||||
import sys
|
import sys
|
||||||
from subprocess import check_call
|
from subprocess import check_call
|
||||||
from io import open as io_open
|
from io import open as io_open
|
||||||
|
@ -23,7 +29,8 @@ import re
|
||||||
|
|
||||||
# Get version from tqdm/_version.py
|
# Get version from tqdm/_version.py
|
||||||
__version__ = None
|
__version__ = None
|
||||||
version_file = os.path.join(os.path.dirname(__file__), 'tqdm', '_version.py')
|
src_dir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
version_file = os.path.join(src_dir, 'tqdm', '_version.py')
|
||||||
with io_open(version_file, mode='r') as fd:
|
with io_open(version_file, mode='r') as fd:
|
||||||
exec(fd.read())
|
exec(fd.read())
|
||||||
|
|
||||||
|
@ -119,8 +126,7 @@ def execute_makefile_commands(commands, alias, verbose=False):
|
||||||
if verbose:
|
if verbose:
|
||||||
print("Running command: " + cmd)
|
print("Running command: " + cmd)
|
||||||
# Launch the command and wait to finish (synchronized call)
|
# Launch the command and wait to finish (synchronized call)
|
||||||
check_call(parsed_cmd,
|
check_call(parsed_cmd, cwd=src_dir)
|
||||||
cwd=os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
|
|
||||||
|
|
||||||
# Main setup.py config #
|
# Main setup.py config #
|
||||||
|
@ -129,7 +135,7 @@ def execute_makefile_commands(commands, alias, verbose=False):
|
||||||
# Executing makefile commands if specified
|
# Executing makefile commands if specified
|
||||||
if sys.argv[1].lower().strip() == 'make':
|
if sys.argv[1].lower().strip() == 'make':
|
||||||
# Filename of the makefile
|
# Filename of the makefile
|
||||||
fpath = os.path.join(os.path.dirname(__file__), 'Makefile')
|
fpath = os.path.join(src_dir, 'Makefile')
|
||||||
# Parse the makefile, substitute the aliases and extract the commands
|
# Parse the makefile, substitute the aliases and extract the commands
|
||||||
commands = parse_makefile_aliases(fpath)
|
commands = parse_makefile_aliases(fpath)
|
||||||
|
|
||||||
|
@ -159,7 +165,7 @@ if sys.argv[1].lower().strip() == 'make':
|
||||||
# Python package config #
|
# Python package config #
|
||||||
|
|
||||||
README_rst = ''
|
README_rst = ''
|
||||||
fndoc = os.path.join(os.path.dirname(__file__), 'README.rst')
|
fndoc = os.path.join(src_dir, 'README.rst')
|
||||||
with io_open(fndoc, mode='r', encoding='utf-8') as fd:
|
with io_open(fndoc, mode='r', encoding='utf-8') as fd:
|
||||||
README_rst = fd.read()
|
README_rst = fd.read()
|
||||||
|
|
||||||
|
@ -174,7 +180,7 @@ setup(
|
||||||
maintainer='tqdm developers',
|
maintainer='tqdm developers',
|
||||||
maintainer_email='python.tqdm@gmail.com',
|
maintainer_email='python.tqdm@gmail.com',
|
||||||
platforms=['any'],
|
platforms=['any'],
|
||||||
packages=['tqdm'],
|
packages=['tqdm'] + ['tqdm.' + i for i in find_packages('tqdm')],
|
||||||
entry_points={'console_scripts': ['tqdm=tqdm._main:main'], },
|
entry_points={'console_scripts': ['tqdm=tqdm._main:main'], },
|
||||||
data_files=[('man/man1', ['tqdm.1'])],
|
data_files=[('man/man1', ['tqdm.1'])],
|
||||||
package_data={'': ['CONTRIBUTING.md', 'LICENCE', 'examples/*.py']},
|
package_data={'': ['CONTRIBUTING.md', 'LICENCE', 'examples/*.py']},
|
||||||
|
|
Loading…
Reference in New Issue