question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best way to parameterize the version

See original GitHub issue

Just wanted to get an opinion on this. As part of a continuous build pipeline, the conan package building step will have the version given by the CI system in an environment variable. It seems I can’t do:

    version = os.environ['VARIABLE_VERSION']

in my conanfile.py; so the only thing I can come up with is to use perl or something to generate the conanfile.py from a template and then export the generated file.

Is there a better way?

John

P.S. - Nice job on 0.20. I really like the fixes to environment vars.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, Feb 9, 2018

Not directly, but you can do it. Some hints:

  • Have a global function in the recipe, that generates a “requires.txt”.
  • Make that function to fail gently and do nothing when it doesn’t find the necessary things you have in your folder when you “export”.
  • Call that function in global namespace
  • Do a exports of that requires.txt
  • In your requirements() method, load the requires.txt file (will be in the local cache), and define the self.requires() with the values in it.
1reaction
tamborilcommented, Mar 1, 2017

Thank you. I verified this works and is only used during export. It is safe to have the variable missing from the environment upon install. I think the error I was having was not setting the variable on install, and the key was missing in the os.environ dict. I just changed it to a os.environ.get(key, default) instead, and the default value is safely ignored at install time. getenv() looks even more apropriate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with parameter versions - AWS Systems Manager
The following procedures show you how to edit a parameter and then verify that you created a new version. You can use the...
Read more >
Working with parameter versions - Amazon Systems Manager
Create a new version of a parameter (console) · In the navigation pane, choose Parameter Store. · Choose the name of a parameter...
Read more >
parameterized - PyPI
The names of the test cases generated by @parameterized.expand can be customized using the name_func keyword argument. The value should be a function...
Read more >
Parameterization In TestNG - DataProvider and TestNG XML ...
This article will talk about Parameterization in TestNG for Selenium automation testing using both DataProvider and the Parameter annotation ...
Read more >
Parameterization – Load Testing with LoadRunner Tutorial #6
This LoadRunner VuGen Parameterization Tutorial will help you to learn Parameterization in detail along with the types of parameters and the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found