我刚刚开始使用setuptools和virtualenv.我的包需要最新的python-gearman,只能从GitHub获得.PyPI上的python-gearman版本是旧版本.Github源代码是setuptools兼容的,即有setup.py等.有没有办法让setuptools下载并安装新版本,而不是在PyPI上查找并安装旧版本?
仅供参考,新的python-gearman是http://github.com/mtai/python-gearman
我试图通过子类化MKAnnotationView和重写drawRect方法来创建自定义注释视图.我希望从注释的位置偏移绘制视图,有点像MKPinAnnotationView它,因此引脚的点位于指定的坐标处,而不是引脚的中间位置.所以我设置框架位置和大小,如下所示.但是,它看起来不像我可以影响框架的位置,只有大小.图像最终被绘制在注释位置的中心.关于如何实现我想要的任何提示?
MyAnnotationView.h:
@interface MyAnnotationView : MKAnnotationView {
}
Run Code Online (Sandbox Code Playgroud)
MyAnnotationView.m:
- (id)initWithAnnotation:(id <MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]) {
self.canShowCallout = YES;
self.backgroundColor = [UIColor clearColor];
// Position the frame so that the bottom of it touches the annotation position
self.frame = CGRectMake(0, -16, 32, 32);
}
return self;
}
- (void)drawRect:(CGRect)rect {
[[UIImage imageNamed:@"blue-dot.png"] drawInRect:rect];
}
Run Code Online (Sandbox Code Playgroud) 我有一个C++项目,其中包含所有其他C++文件所依赖的生成文件.我试图在任何其他编译开始之前强制生成和编译该文件.通常它就像将文件放在all:目标中一样简单,但复杂的是我的Makefile也是由构建系统生成的,我只能将片段附加到Makefile,而不是一般编辑它.
那么,是否有办法强制生成的文件目标首先通过依赖项或其他方式运行?我想过用这样的东西:
cpp_files := $(wildcard src/*.cpp)
$(cpp_files): generated_file.cpp
generated_file.cpp:
# generate the file here
Run Code Online (Sandbox Code Playgroud)
但它似乎没有用.作为参考,我的源目录结构是这样的,所以我需要递归地收集cpp文件:
src/
|---file1.cpp
|---file2.cpp
|---subdir1/
|---file3.cpp
gen/
|---generated_file.cpp
Run Code Online (Sandbox Code Playgroud)