-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): Write .env with absolute path for conf on make install
The old checked-in .env had a relative path into tests/ for the development index.json file that drives settings. This makes it impossible to import opentrons from outside the api directory. One way to fix this would be to add correct, sane, and not duplicated logic to the way we load settings; another is to write the .env and the index.json with absolute paths when you run make install. Also, this fixes an issue where ‘make local-install’ worked on appveyor (because appveyor uses mingw make) but doesn’t work on other dev setups that install make using e.g. chocolatey into the windows shell or powershell, which do not do wildcard expansion. Closes #2495
- Loading branch information
Showing
5 changed files
with
36 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import json | ||
import os | ||
|
||
here = os.getcwd() | ||
|
||
with open('./.env', 'w') as dotenv: | ||
dotenv.write('OVERRIDE_SETTINGS_DIR={}'.format(here)) | ||
|
||
shared_data = os.path.join(here, os.pardir, 'shared-data') | ||
test_data = os.path.join(here, 'tests', 'opentrons', 'data') | ||
local_index = { | ||
"labware": { | ||
"baseDefinitionDir": os.path.join(shared_data, 'definitions'), | ||
"userDefinitionDir": os.path.join(test_data, 'labware-def', | ||
'definitions'), | ||
"offsetDir": os.path.join(test_data, 'labware-def', 'offsets') | ||
}, | ||
"pipetteConfigFile": os.path.join(shared_data, 'robot-data', | ||
'pipette-config.json'), | ||
"featureFlagFile": os.path.join(shared_data, 'settings.json'), | ||
"deckCalibrationFile": os.path.join(test_data, | ||
'configs', | ||
'deckCalibration.json'), | ||
"robotSettingsFile": os.path.join(test_data, 'configs', | ||
'robotSettings.json') | ||
} | ||
|
||
with open('./index.json', 'w') as index: | ||
index.write(json.dumps(local_index)) |