Skip to content

Commit

Permalink
fixed package data in setup.py after pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
arne-cl committed Dec 24, 2017
1 parent 20bde4c commit 7ff7b45
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WORKDIR /opt
# install OpenCCG for surface realization, then install pypolibox
RUN wget https://downloads.sourceforge.net/project/openccg/openccg/openccg%20v0.9.5%20-%20deplen%2C%20kenlm%2C%20disjunctivizer/openccg-0.9.5.tgz && \
tar -xvzf openccg-0.9.5.tgz && \
git clone https://github.com/arne-cl/pypolibox
git clone https://github.com/arne-cl/pypolibox.git

WORKDIR /opt/pypolibox
RUN python setup.py install
Expand Down
33 changes: 32 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,37 @@
install_requires = ["lxml", "nltk", "pexpect", "pyaml", "sphinxcontrib-napoleon"]


def gen_data_files(src_dir):
"""
generates a list of files contained in the given directory (and its
subdirectories) in the format required by the ``package_data`` parameter
of the ``setuptools.setup`` function.
Parameters
----------
src_dir : str
(relative) path to the directory structure containing the files to
be included in the package distribution
Returns
-------
fpaths : list(str)
a list of file paths
"""
fpaths = []
base = os.path.dirname(src_dir)
for root, dir, files in os.walk(src_dir):
if len(files) != 0:
for f in files:
fpaths.append(os.path.relpath(os.path.join(root, f), base))
return fpaths


package_data_list = gen_data_files('data/*')
package_data_list.extend(gen_data_files('grammar/*'))
package_data_list.append('avm.sty')


setup(name='pypolibox',
version=version,
description="text generation for product recommendations using OpenCCG",
Expand All @@ -34,7 +65,7 @@
license='GPL Version 3',
packages=['pypolibox'],
package_dir = {'pypolibox': "src/pypolibox"},
package_data = {'pypolibox': ['data/*', 'grammar/*', 'avm.sty']},
package_data = {'pypolibox': package_data_list},
zip_safe=False,
install_requires=install_requires,
entry_points={
Expand Down

0 comments on commit 7ff7b45

Please sign in to comment.