-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage.py
37 lines (29 loc) · 810 Bytes
/
package.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python3
# Generate the composer.json file
import glob
import json
filesConfig = []
psr4Config = {}
composerConfig = {
"name": "example.com/test",
"type": "library",
"require": {
"ext-grpc": "*",
"ext-protobuf": "*",
"grpc/grpc": "*",
"google/gax": "*",
"google/protobuf": "*"
},
"autoload": {
"files": filesConfig,
"psr-4": psr4Config
}
}
for file in sorted(glob.glob("build/*.php")):
filesConfig.append(file)
for directory in sorted(glob.glob("build/*/")):
namespace = directory.strip("/").replace("build/", "")
psr4Config[f"{namespace}\\"] = directory
composerString = json.dumps(composerConfig, indent=4, sort_keys=True)
with open('composer.json', 'w') as writer:
writer.write(composerString)