Skip to content

Commit

Permalink
Use package_data instead of data_files. Fixes devexp-db#66 and devexp…
Browse files Browse the repository at this point in the history
  • Loading branch information
bkabrda committed Apr 18, 2018
1 parent 2634846 commit 3d13e1c
Show file tree
Hide file tree
Showing 42 changed files with 13 additions and 30 deletions.
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ include LICENSE
include Makefile
include NEWS
include tests/testsuite
include distconf/lib/*.yaml
include distconf/*.yaml
include docs/*.rst
include docs/conf.py
include docs/Makefile
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test-end2end:
@cd tests/ && PYTHON=${PYTHON} ./testsuite

test-unit:
DG_DISTCONFDIR=./distconf PYTHONPATH=..:$${PYTHONPATH} ${PYTHON} -m pytest `[ ! -z ${COVERAGE} ] && echo "--cov distgen"` tests/unittests/
PYTHONPATH=..:$${PYTHONPATH} ${PYTHON} -m pytest `[ ! -z ${COVERAGE} ] && echo "--cov distgen"` tests/unittests/

test-lint:
flake8 distgen/
Expand Down
3 changes: 0 additions & 3 deletions dg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@ proj_cli_dir="$(dirname "$(readlink -f "$0")")"
export PYTHON=${PYTHON:-`which python2`}
export PYTHONPATH="$proj_cli_dir${PYTHONPATH+:$PYTHONPATH}"

export DG_TPLDIR="$proj_cli_dir/templates"
export DG_DISTCONFDIR="$proj_cli_dir/distconf"

$PYTHON $proj_cli_dir/bin/dg "$@"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions distgen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ class Generator(object):
pm_spc = None

def __init__(self, global_jinja_args=None):
here = os.path.dirname(os.path.abspath(__file__))
self.pm_cfg = PathManager(
[os.path.join(sys.prefix, "share", "distgen", "distconf")],
[os.path.join(here, "distconf"),
os.path.join(sys.prefix, "share", "distgen", "distconf")],
envvar="DG_DISTCONFDIR"
)

self.pm_tpl = PathManager(
[os.path.join(sys.prefix, "share", "distgen", "templates")],
[os.path.join(here, "templates"),
os.path.join(sys.prefix, "share", "distgen", "templates")],
envvar="DG_TPLDIR"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions rpm/distgen.spec.dg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ file and preexisting distribution metadata generate output file.

%install
%{pybin} setup.py install --root=%{buildroot}
mkdir -p %{buildroot}%{_datadir}/distgen
mv %{buildroot}%{pylib}/distgen/{distconf,templates} %{buildroot}%{_datadir}/distgen


%check
Expand Down
27 changes: 5 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@
raise


def dynamic_data_files():
dynamic_list = []
for dcdir in ["distconf", "distconf/lib"]:
dcfiles = ["{0}/{1}".format(dcdir, f)
for f in listdir(dcdir)]
dcfiles = [f for f in dcfiles if path.isfile(f)]
dynamic_list.append((pkgdatadir + "/" + dcdir, dcfiles))

return dynamic_list


def get_requirements():
with open('requirements.txt') as f:
return f.read().splitlines()
Expand All @@ -52,17 +41,11 @@ def get_requirements():
url='https://github.com/devexp-db/distgen',
platforms=['any'],
packages=['distgen'],
data_files=[
(tpldir + '/container/docker', [
'templates/container/docker/parts.tpl',
]),
(tpldir, [
'templates/docker.tpl',
'templates/makefile-macros.tpl',
'templates/README',
'templates/general.tpl',
]),
] + dynamic_data_files(),
# this is bit impractical, but I see no better way to include subdirs properly
package_data={'distgen':
['distconf/*.yaml', 'distconf/**/*.yaml',
'templates/*.tpl', 'templates/**/*.tpl', 'templates/**/**/*.tpl']
},
scripts=['bin/dg'],
install_requires=get_requirements(),
cmdclass={
Expand Down

0 comments on commit 3d13e1c

Please sign in to comment.