2
2
# Running:
3
3
# * pyinstaller -F splitgraph.spec produces a single sgr binary in the dist/ folder
4
4
# with libc being the only dynamic dependency (python interpreter included)
5
- # * can also do poetry install && poetry run -F splitgraph.spec to build the binary inside of the poetry's venv.
5
+ # * can also do poetry install && poetry run pyinstaller -F splitgraph.spec to build the binary inside of the poetry's venv.
6
6
7
7
block_cipher = None
8
8
9
- # per https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Setuptools-Entry-Point
10
- def Entrypoint (dist , group , name , ** kwargs ):
11
- import pkg_resources
12
-
13
- # get toplevel packages of distribution from metadata
14
- def get_toplevel (dist ):
15
- distribution = pkg_resources .get_distribution (dist )
16
- if distribution .has_metadata ('top_level.txt' ):
17
- return list (distribution .get_metadata ('top_level.txt' ).split ())
18
- else :
19
- return []
20
-
21
- kwargs .setdefault ('hiddenimports' , [])
22
- packages = []
23
- for distribution in kwargs ['hiddenimports' ]:
24
- packages += get_toplevel (distribution )
25
-
26
- kwargs .setdefault ('pathex' , [])
27
- # get the entry point
28
- ep = pkg_resources .get_entry_info (dist , group , name )
29
- # insert path of the egg at the verify front of the search path
30
- kwargs ['pathex' ] = [ep .dist .location ] + kwargs ['pathex' ]
31
- # script name must not be a valid module name to avoid name clashes on import
32
- script_path = os .path .join (workpath , name + '-script.py' )
33
- print ("creating script for entry point" , dist , group , name )
34
- with open (script_path , 'w' ) as fh :
35
- print ("import" , ep .module_name , file = fh )
36
- print ("%s.%s()" % (ep .module_name , '.' .join (ep .attrs )), file = fh )
37
- for package in packages :
38
- print ("import" , package , file = fh )
9
+ a = Analysis (['bin/sgr' ],
10
+ pathex = ['.' ],
11
+ hiddenimports = [],
12
+ # Disable ingestion extras for now (we're looking at replacing this
13
+ # with something more lightweight)
14
+ excludes = ['pandas' ,'numpy' ,'scipy' , 'sqlalchemy' ],
15
+ hookspath = [],
16
+ runtime_hooks = [],
17
+ cipher = block_cipher )
39
18
40
- return Analysis (
41
- [script_path ] + kwargs .get ('scripts' , []),
42
- ** kwargs
43
- )
19
+ a .datas += Tree ('./splitgraph/resources' , 'splitgraph/resources' )
44
20
45
- a = Entrypoint ('splitgraph' , 'console_scripts' , 'sgr' ,
46
- datas = [('splitgraph/resources' , 'splitgraph/resources' )]) # Add the resources folder with the audit trigger
47
21
pyz = PYZ (a .pure , a .zipped_data ,
48
22
cipher = block_cipher )
49
23
exe = EXE (pyz ,
@@ -59,4 +33,3 @@ exe = EXE(pyz,
59
33
upx = True ,
60
34
runtime_tmpdir = None ,
61
35
console = True )
62
-
0 commit comments