Permalink
Browse files

Add a deploy script to update Xcode.app

  • Loading branch information...
xcv58 committed Jul 17, 2018
1 parent 0a72155 commit 8b2eeaeb9e79fb8377e6d3f8ec2e5cc52b76e4fe
Showing with 57 additions and 0 deletions.
  1. +22 −0 README.md
  2. +35 −0 deploy.py
@@ -3,6 +3,28 @@ This repository holds the device support files for the iOS, and I will update it
### Usage:
See docs: [https://ighibli.github.io/2017/03/28/Could-not-locate-device-support-files/](https://ighibli.github.io/2017/03/28/Could-not-locate-device-support-files/)
Below command will try to unzip all new device support files to `/Applications/Xcode.app`.
```sh
sudo ./deploy.py
```
You can use `-t` if your Xcode is not in `/Applications/` or has different name.
```sh
sudo ./deploy.py -t /Applications/Xcode\ 9.app
```
```sh
./deploy.py -h
usage: deploy.py [-h] [-t TARGET]
optional arguments:
-h, --help show this help message and exit
-t TARGET The path for Xcode
```
### Supported versions:
1. iOS8
* 8.0 `2017/04/07`
@@ -0,0 +1,35 @@
#!/usr/bin/env python
import argparse
import zipfile
from os import listdir, path
SRC = path.join(path.dirname(path.abspath(__file__)), 'DeviceSupport')
DEVICE_SUPPORT_PATH='Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport'
def unzip_file(name, target):
f = path.join(SRC, name + '.zip')
zip_ref = zipfile.ZipFile(f, 'r')
zip_ref.extractall(target)
zip_ref.close()
def process(xcode):
target = path.join(xcode, DEVICE_SUPPORT_PATH)
exist = listdir(target)
all_files = [i.replace('.zip', '') for i in listdir(SRC) if i.endswith('.zip')]
new_files = list(set(all_files) - set(exist))
for i in new_files:
print 'Unzip file "{}.zip" to {}'.format(i, target)
unzip_file(i, target)
print '\nUpdate successfully for {}'.format(xcode)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'-t',
type=str,
dest='target',
default='/Applications/Xcode.app',
help='The path for Xcode'
)
args = parser.parse_args()
process(args.target)

0 comments on commit 8b2eeae

Please sign in to comment.