Skip to content

Commit

Permalink
minor fixes before release
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantkushwaha committed Dec 19, 2020
1 parent f298bc8 commit 6c7c4f4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist
palladium_python.egg-info
palladium/config.json
palladium/chromium
palladium/chromium
assets
20 changes: 10 additions & 10 deletions palladium/chromium_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def read_state(dirpath):


def write_state(dirpath, binary_path, driver_path):
config = {'modified_time': datetime.now().isoformat(), 'chromebinary': binary_path, 'chromedriver': driver_path}
config = {'modified_time': datetime.now().isoformat(), 'chromium': binary_path, 'chromedriver': driver_path}
with open(os.path.join(dirpath, 'state.json'), 'w') as config_fp:
json.dump(config, config_fp)

Expand Down Expand Up @@ -154,22 +154,22 @@ def shell(dir_path):

""" -------------------------------------------- Return paths -------------------------------------------------- """
binary_path_by_platform = {
'Windows': os.path.join('chromium', 'chrome.exe'),
'Linux': os.path.join('chromium', 'chrome'),
'Darwin': os.path.join('chromium', 'Chromium.app', 'Contents', 'MacOS', 'Chromium')
'Windows': os.path.join('chrome-win', 'chrome.exe'),
'Linux': os.path.join('chrome-linux', 'chrome'),
'Darwin': os.path.join('chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium')
}

driver_path_by_platform = {
'Windows': os.path.join('chromedriver', 'chromedriver.exe'),
'Linux': os.path.join('chromedriver', 'chromedriver'),
'Darwin': os.path.join('chromedriver', 'chromedriver'),
'Windows': os.path.join('chromedriver_win32', 'chromedriver.exe'),
'Linux': os.path.join('chromedriver_linux64', 'chromedriver'),
'Darwin': os.path.join('chromedriver_mac64', 'chromedriver'),
}

binary_path = os.path.join(zipdir, 'chromebinary', binary_path_by_platform[platform_name])
binary_path = os.path.join(zipdir, 'chromium', binary_path_by_platform[platform_name])
driver_path = os.path.join(zipdir, 'chromedriver', driver_path_by_platform[platform_name])

return binary_path, driver_path
return os.path.abspath(binary_path), os.path.abspath(driver_path)


if __name__ == '__main__':
setup('.')
setup('.', start_over=True)
6 changes: 3 additions & 3 deletions palladium/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

setup(module_dir)

with open(os.path.join(module_dir, 'config.json'), 'r') as fp:
with open(os.path.join(module_dir, 'assets', 'state.json'), 'r') as fp:
config = json.load(fp)
chromebinary = config.get('chromebinary', None)

chromebinary = config.get('chromium', None)
chromedriver = config['chromedriver']

0 comments on commit 6c7c4f4

Please sign in to comment.