How to use conan compon with my own build system? can you give me a demo? - conan

I am new to conan, and I want to use the feature of component of conan,
I read the https://docs.conan.io/en/latest/creating_packages/package_information.html
but still cannot know how to use it .
likes the example:
'''
self.cpp_info.name = "OpenSSL"
self.cpp_info.components["crypto"].names["cmake_find_package"] = "Crypto"
self.cpp_info.components["crypto"].libs = ["libcrypto"]
self.cpp_info.components["crypto"].defines = ["DEFINE_CRYPTO=1"]
self.cpp_info.components["ssl"].names["cmake"] = "SSL"
self.cpp_info.components["ssl"].includedirs = ["include/headers_ssl"]
self.cpp_info.components["ssl"].libs = ["libssl"]
self.cpp_info.components["ssl"].requires = ["crypto"]
'''
why the crypto self.cpp_info.components["crypto"].names["cmake_find_package"] = "Crypto" ?
my build system is not based on CMake.
how to extract files to every component?
how to copy to local cache?
how to consume one component?
can anyone can give a demo how to create two libs and how to consume the libs
based on
https://github.com/shreyasbharath/conan-package-binary-example
https://github.com/shreyasbharath/conan-package-binary-consume-example
Thanks you very much !

Related

Is the Mapbox access token still required for Kepler.gl?

we plan to integrate Kepler.gl into our open source analytics platform which will be used by many users. We have successfully integrated the library into our code and are able to visual beautiful maps with our data. The library is awesome and we want to use it but aren't sure about the Mapbox integration. Our code works without setting any Mapbox access token. Is the token no longer required if one uses the Kepler.gl with default settings? Are there any limitations in using it without a token e.g. will no longer work if more than 100 users use it?
This is the Kepler.gl related code that we used:
map_1 = KeplerGl(show_docs=False)
map_1.add_data(data=gdf.copy(), name="state")
config = {}
if self.save_config:
# Save map_1 config to a file
# config_str = json.dumps(map_1.config)
# if type(config) == str:
# config = config.encode("utf-8")
with open("kepler_config.json", "w") as f:
f.write(json.dumps(map_1.config))
if self.load_config:
with open("kepler_config.json", "r") as f:
config = json.loads(f.read())
map_1.config = config
# map_1.add_data(data=data.copy(), name="haha")
html = map_1._repr_html_()
html = html.decode("utf-8")
Thanks for your help
Tobias

How to use the Executable (defined as Capability in Bamboo) in the plugin code

From the sample code on Atlassian site
https://developer.atlassian.com/server/bamboo/executing-external-processes-using-processservice/
ExternalProcess process = ProcessService.createExternalProcess(taskContext, new ExternalProcessBuilder().*command*(Arrays.asList("**/bin/ls**")). workingDirectory(fileWorkingDir));
What Bamboo API should I use to fetch "/home/kshi/.local/bin/robot" and pass it to command(). Getting the values from TaskConfiguration configuration map, or TaskDefinition did not help.
I do have the below tag in my atlassian-plugin.xml
< executable key="**robot**" nameKey="RobotFrameworkTest.robotExecutable"/ >
RobotFrameworkTest.robotExecutable points to "robot"
I want to make use of the Executable defined in bamboo. (/home/kshi/.local/bin/root)
From the logs of the plan I can see that Bamboo is referring to the robot command as bamboo.capability.system.builder.command.robot, wondering if I have to use it in the same way in the code.
I have found a relevant link on Atlassian website hinting ways to use an
executable.
https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-access-build-variables-from-a-bamboo-task/qaq-p/572570
#ComponentImport private final ProcessService processService;
#ComponentImport private final CapabilityContext capabilityContext;
public RobotTestTaskType(final ProcessService processService, final CapabilityContext capabilityContext)
{ this.processService = processService; this.capabilityContext = capabilityContext; }
String robotExecutable = capabilityContext.getCapabilityValue("system.builder.command.robot");

nexus3 api how to search component from groupId and artifactId

I search a way to request components or assets from groupId and artefactId.
Documentation provides any help about how to create this request.
This doc has been a great help.
Unfortunately, it's not enough to resolve my need and I try to create query to request components from groupId and artefactId like that:
Query.builder().where('group = ').param('###').and('name = ').param('###').and('version = ').param('###).build()
Last time I played my script it throwed java.lang.StackOverflowError. After increasing memory, I had the same result. It seems there is too much components to return, but in my nexus repository there's only one component with such group, name and version.
What's wrong with this query?
Is there someone pass this difficulty (it was so easy with nexus2 and rest api!) and retrieve components information with a groovy script?
Here is the script I successfully uploaded and use. You may easily add version to your requests - the parameter will be, for example, "snapshots-lib,com.m121.somebundle,someBundle,7.2.1-SNAPSHOT,all". As you may see, I decided to filter the sequence locally, because did not find the way to specify in query version parameter.
{
"name": "listgroup",
"type": "groovy",
"content": "import org.sonatype.nexus.repository.storage.Query;
import org.sonatype.nexus.repository.storage.StorageFacet;
import groovy.json.JsonOutput;
def repositoryId = args.split(',')[0];
def groupId = args.split(',')[1];
def artifactId = args.split(',')[2];
def baseVersion = args.split(',')[3];
def latestOnly = args.split(',')[4];
def repo = repository.repositoryManager.get(repositoryId);
StorageFacet storageFacet = repo.facet(StorageFacet);
def tx = storageFacet.txSupplier().get();
tx.begin();
def components = tx.findComponents(Query.builder().where('group = ').param(groupId).and('name = ').param(artifactId).build(), [repo]);
def found = components.findAll{it.attributes().child('maven2').get('baseVersion')==baseVersion}.collect{def version = it.attributes().child('maven2').get('version');\"${version}\"};
// found = found.unique().sort();
def latest = found.isEmpty() ? found : found.last();
tx.commit();
def result = latestOnly == 'latest' ? JsonOutput.toJson(latest) : JsonOutput.toJson(found);
return result;"
}
okee,
in fact my needs are :
i want to retrieve last release version and its date of a component by group and artefact.
I definitely leave the groovy API option.
A way i found consists in use of extdirect api. This "rest" api is used by nexus frontend to communicate with backend. No documentation exists.
I do a call to extdirect api to retrieve all versions from a component by group and artefact. I parse the results to get the last version on a release (snapshot and releases).
It's not really good because this call retrieves all the versions on all repositories and could be huge.
Another call to extdirect api to find the release date from the component id of the last release version.
I hope someday nexus publishs official documentation of an useful rest api.

Ruby-AWS where to save config / how to load config

I am not sure what is the best way to do an appliaction wide configuration of the Ruby/Aws gem?
I found an example of how a configuration file needs to look like: https://forums.aws.amazon.com/message.jspa?messageID=117931#117931
But what is the recommended way to store the configuration? Shall I put a simple file in config/amazonrc
and then call
Amazon::Config.new("#{RAILS_ROOT}/config/amazonrc")
I found now a good solution:
config/initializers/amazon.rb
require File.dirname(__FILE__) + '/../../config/environment.rb'
ENV['AMAZONRCDIR'] = "#{Rails.root}/config/"
config/.amazonrc
[global]
locale = 'de'
cache = false
key_id = '0Y44V8FAFNM119C6PXX2'
secret_key_id = 'YYYYYY'
[de]
associate = 'ID-21'

Scons (Build System) Variables : load config file with custom/unknown values

I have a trouble with Scons.Variables. I want to use config files with custom keys and values. My idea to load config files with keys and values and use it with SubstFile method.
For example (rough code) :
vars = Variables('templateValues.conf')
vars_dict = vars.UnknownVariables().keys() # bad code, need something to convert vars to Python dictionary
env.Substfile('myconfig.cfg.in', SUBST_DICT = vars_dict)
But vars.UnknownVariables() return empty list.
My test template file :
version = 105
mode = 'release'
source = 'database'
emulate = 'no'
And vars.UknownVariables() called :
vars = Variables('templateValues.conf')
print vars.UnknownVariables().keys()
# []
May be somebody try to implement something like this and can give some advances ?
I not found neeeded tools in Scons, but Python is great (i newbie in python now, few days studing only).
Google give me some useful links, such as SimpleConfigParser (i use method from CustomParser)
Implement it is very easy and i got what i need :
Import('env')
templVars = parse_config('template.conf')
varEnv = env.Clone(tools = ['textfile', 'default'])
varEnv.Substfile('config.cfg.in', SUBST_DICT = templVars)
Content of config.cfg.in file :
this is simple text with template values
Version is %version%
Build mode is %mode%
Emulator mode %emulate%
Thanks for using Avina !
Content of template.conf file :
%version% = 105
%mode% = 'test1'
%source% = 'database'
%emulate% = 'no'
And result file :
this is simple text with template values
Version is 105
Build mode is 'test1'
Emulator mode 'no'
Thanks for using Avina !