Commits

Jason R. Coombs committed 09a0d83

A second attempt (also works)

Comments (0)

Files changed (5)

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))

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

-import mycode
-
-mycode.my_func()

8628495/myproject/mycode.py

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

8628495/scripts/run-my-code.py

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