Commits

Jason R. Coombs committed dcf1349

A package-based approach

  • Participants
  • Parent commits 343dfc8

Comments (0)

Files changed (5)

File 8628495/build/lib/mycode.py

-import os
-
-here = os.path.dirname(__file__)
-
-def my_func():
-	with open(os.path.join(here, 'data/file1.dat')) as f:
-		print(next(f))

File 8628495/build/scripts-2.7/run-my-code.py

-import mycode
-
-mycode.my_func()

File 8628495/myproject/__init__.py

Empty file added.

File 8628495/scripts/run-my-code.py

-import mycode
+from myproject import mycode
 
 mycode.my_func()

File 8628495/setup.py

 	name='myproject',
 	version='1.0',
 	scripts=['scripts/run-my-code.py'],
-	data_files = [
-		('data',
-			['myproject/data/file1.dat']
-		),
-	],
-	# modules can be found in myproject
-	package_dir = {'': 'myproject'},
-	py_modules=['mycode'],
+	packages=['myproject'],
+	package_data = {
+		'myproject': ['data/file1.dat'],
+	},
 )