简体   繁体   English

将现有 python 项目导入 XCode

[英]Import an existing python project to XCode

I've got a python project I've been making in terminal with vim etc.. I've read that XCode supports Python development at that it supports SVN (which I am using) but I can't find documentation on how to start a new XCode project from an existing code repository. I've got a python project I've been making in terminal with vim etc.. I've read that XCode supports Python development at that it supports SVN (which I am using) but I can't find documentation on how to start来自现有代码存储库的新 XCode 项目。

Other developers are working on the project not using XCode - They won't mind if I add a project file or something, but they will mind if I have to reorganise the whole thing.其他开发人员正在不使用 XCode 的项目上工作 - 如果我添加项目文件或其他内容,他们不会介意,但如果我必须重新组织整个事情,他们会介意。

I don't think it's worth using Xcode for a pure python project.我认为将 Xcode 用于纯 python 项目不值得。 Although the Xcode editor does syntax-highlight Python code, Xcode does not give you any other benefit for writing a pure-python app.尽管 Xcode 编辑器会语法高亮 Python 代码,但 Xcode 不会为您提供编写纯 Python 应用程序的任何其他好处。 On OS X, I would recommend TextMate as a text editor or Eclipse with PyDev as a more full-featured IDE.在 OS X 上,我会推荐TextMate作为文本编辑器或 Eclipse 和PyDev作为功能更全的 IDE。

I recommend against doing so.我建议不要这样做。 Creating groups (which look like folders) in Xcode doesn't actually create folders in the filesystem.在 Xcode 中创建组(看起来像文件夹)实际上并不在文件系统中创建文件夹。 This wreaks havoc on the module hierarchy.这对模块层次结构造成了严重破坏。

Also, the SCM integration in Xcode is very clunky.此外,Xcode 中的 SCM 集成非常笨拙。 After becoming accustomed to using Subversion with Eclipse, the Subversion support in Xcode is hopelessly primitive.在习惯了使用带有 Eclipse 的 Subversion 之后,Xcode 中的 Subversion 支持是无可救药的原始。 It's almost easier to just do svn commands on the command line just so it's clear what's going on.在命令行上执行 svn 命令几乎更容易,所以很清楚发生了什么。

If you must use Xcode, use it to open individual py files.如果您必须使用 Xcode,请使用它打开单个py文件。 Use it as a slow, relatively featureless text editor.将其用作速度较慢、相对无特色的文本编辑器。

If you must use Xcode for SCM, take a look at their guide to using Xcode with Subversion .如果您必须将 Xcode 用于 SCM,请查看他们使用 Xcode 和 Subversion 的指南

There are no special facilities for working with non-Cocoa Python projects with Xcode.没有使用 Xcode 的非 Cocoa Python 项目的特殊工具。 Therefore, you probably just want to create a project with the "Empty Project" template (under "Other") and just drag in your source code.因此,您可能只想使用“Empty Project”模板(在“Other”下)创建一个项目,然后拖入您的源代码。

For convenience, you may want to set up an executable in the project.为方便起见,您可能希望在项目中设置可执行文件。 You can do this by ctrl/right-clicking in the project source list and choosing "Add" > "New Custom Executable...".您可以通过 ctrl/右键单击项目源列表并选择“添加”>“新建自定义可执行文件...”来执行此操作。 You can also add a target, although I'm not sure what this would buy you.你也可以添加一个目标,虽然我不确定这会给你带来什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM