Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Export important project variables #757
Conversation
sergiusens
referenced this pull request
Aug 25, 2016
Merged
Ant properties, build target, and destination directory options #752
|
hm, to actually support all these in fixed yaml entries like |
elopio
reviewed
Aug 25, 2016
| + self.assertThat(test_name, FileContains('test-environment')) | ||
| + self.assertThat(test_version, FileContains('0.1')) | ||
| + self.assertThat(test_stage, FileContains(stage_dir)) | ||
| + self.assertThat(test_part_install, FileContains(part_install_dir)) |
elopio
Aug 25, 2016
Member
Just a little style nit, I would put the assertions right after each of the vars.
abs_project_dir = os.path.join(os.path.abspath('.'), project_dir)
stage_dir = os.path.join(abs_project_dir, 'stage')
test_name = os.path.join(stage_dir, 'test_name')
self.assertThat(test_name, FileContains('test-environment'))
test_version = os.path.join(stage_dir, 'test_version')
self.assertThat(test_version, FileContains('0.1'))
test_stage = os.path.join(stage_dir, 'test_stage')
self.assertThat(test_stage, FileContains(stage_dir))
part_install_dir = os.path.join(abs_project_dir, 'parts', 'env', 'install')
test_part_install = os.path.join(stage_dir, 'test_part_install')
self.assertThat(test_part_install, FileContains(part_install_dir))
|
I like it! Are you doing that move to the loader? |
|
El jueves, 25 de agosto de 2016 12h'12:57 ART, Leo Arias
Yes, moving the _expand_env logic to the loader is a must now. Enviado con Dekko desde mi dispositivo Ubuntu |
sergiusens
added some commits
Aug 25, 2016
elopio
reviewed
Aug 25, 2016
| + self.assertThat(test_stage, FileContains(stage_dir)) | ||
| + | ||
| + test_part_install = os.path.join(stage_dir, 'test_part_install') | ||
| + self.assertThat(test_part_install, FileContains(part_install_dir)) |
elopio
Aug 25, 2016
Member
this is incredibly nicer, don't you think? Like ten thousand times better, you owe me a beer!
elopio
reviewed
Aug 25, 2016
| +parts: | ||
| + env: | ||
| + plugin: dump | ||
| + source: $SNAPCRAFT_PROJECT_NAME-$SNAPCRAFT_PROJECT_VERSION |
elopio
Aug 25, 2016
Member
I don't understand this one.
The source will be translated to test-environment-0.1, so are you missing that subdirectory?
sergiusens
Aug 26, 2016
Collaborator
indeed it has, commiting empty directories in github is a chore ;-)
elopio
reviewed
Aug 25, 2016
| + ] | ||
| + | ||
| + def _expand_env(self, snapcraft_yaml): | ||
| + skip_keys = ['name', 'version'] |
kyrofa
Aug 25, 2016
•
Member
I'm still trying to figure out why these are skipped in the first place. The code might be a little cleaner if you just went ahead and checked them. Would it hurt anything?
sergiusens
Aug 26, 2016
Collaborator
@kyrofa I wanted to avoid something weird like setting
name: $SNAPCRAFT_PROJECT_NAME
kyrofa
Aug 26, 2016
Member
Yeah, I figured. Man is that ever the corner of cases
|
I still like it! Even better that it now factored the stage dir. |
kyrofa
reviewed
Aug 25, 2016
| +summary: test the SNAPCRAFT_PROJECT_.* variables in key values | ||
| +description: | | ||
| + Tests the snapcraft exported variables in values for key arguments | ||
| + This will fail to pull if the resulting values are not replaced. |
kyrofa
Aug 25, 2016
•
Member
Maybe this should include "or if the source directory doesn't exist"
kyrofa
reviewed
Aug 25, 2016
| + self.assertThat(test_part_install, FileContains(part_install_dir)) | ||
| + | ||
| + def test_project_environment_within_snapcraft(self): | ||
| + """Replace the SNAPCRAFT_PROJECT_.* ocurrences in snapcraft.yaml |
|
This is lovely @sergiusens, I'm a big fan! There might be an improvement to be had in And of course, the broken tests. Coverage dropped, too. |
sergiusens
added some commits
Aug 26, 2016
|
retest this please |
|
this still looks good to me. |
sergiusens
added some commits
Aug 26, 2016
|
|
sergiusens commentedAug 25, 2016
This generally exports:
SNAPCRAFT_PROJECT_NAMESNAPCRAFT_PROJECT_VERSIONSNAPCRAFT_PROJECT_STAGEand for each part:
SNAPCRAFT_PART_INSTALLLP: #1588336
Signed-off-by: Sergio Schvezov sergio.schvezov@ubuntu.com