Skip to content

Commit 4d22d05

Browse files
committed
Move into package. Make sure to include templates when installing.
1 parent 636882f commit 4d22d05

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
from setuptools import setup
1+
from setuptools import setup, find_packages
22
# TODO: include package data (templates)
33
setup(
44
name='syrup',
55
version='0.0.1',
6-
py_modules=['syrup'],
6+
packages=find_packages(),
7+
package_data={
8+
'': ['templates/*']
9+
},
710
install_requires=[
811
'click',
912
'requests',
1013
'Pillow',
1114
],
1215
entry_points='''
1316
[console_scripts]
14-
syrup=syrup:cli
17+
syrup=syrup.__main__:cli
1518
''',
19+
zip_safe=True,
1620
)

syrup/__init__.py

Whitespace-only changes.

syrup.py renamed to syrup/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def cleanBuild(builddir):
162162

163163
def cleanArtifacts(artifactdir):
164164
print("Cleaning artifact directory...")
165-
if os.path.exists("artifactdir"):
165+
if os.path.exists(artifactdir):
166166
shutil.rmtree(artifactdir, onerror=lambda func, path, exec_info: print("WARNING: Failed to delete ", path, exec_info))
167167

168168
def copySrc(src_dir, build_dir):
@@ -186,7 +186,7 @@ def compileNSISTemplate(build_dir, artifact_dir, executables, **kwargs):
186186
"Generates NSIS script from jinja2 template"
187187
print("Generating NSIS script...")
188188
import jinja2
189-
loader = jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates'))
189+
loader = jinja2.PackageLoader(__package__)
190190
env = jinja2.Environment(loader=loader, autoescape=False, undefined=jinja2.StrictUndefined)
191191

192192
template = env.get_template("generic.nsi.j2")

0 commit comments

Comments
 (0)